Prime Generator code

this is a code for generating prime i am checking the number to be divisible by 2 ,3 & 5 first & after that by 7 , 11 & 13 and after that if it is divided by any prime number from 13 to 997.
the link to problem is
the link to my code is

you stored primes upto 1000 , whereas primes can be much much larger than that .

ok…thank you

ok here is the new code for the same problem
But here i am divding the number upto ceiling of sqrt only.but still getting wrong answer.

Your final code is not giving any output on most of cases like
if m = 10 , n = 20;

and your first code was giving wrong output in cases like
if m=4,n = 4, out put should be a blank like but your program gives an output of integer 2.

ok.fixed another problem now it should be working.problem was with for loop bracket.

Yet a lot of inputs are not working like…
m=1 n=2
m=2 n=5

it gives out put 1 3 5

whereas output should be 2 2 3 5

If it really helped just accept this as answer by clicking the green tick button bellow my answer

here is new code :-
fixed all problems i could find

Still there is a wrong input m=1,n=1 in ur program it is considered that 1 is a prime number

thnks.after fixing the above problem , solution is still wrong.