Infosys Interview Question

Find a prime number between given range. Write the optimized working code of it.