I need to find the least prime divisor of of all numbers up to N=$100004$
What i have done till now is :
Generated all prime numbers till N and if number is prime then its lpd is number itself . If number is not a prime then ,
1.check if it is even ,if found even then its lpd is 2 and we got it so don't need to check anything else . 2.check if it is divisible by 3 then its lpd is 3 and we got it so don't need to check anything else .. 3.check if it is divisible by 5 then its lpd is 5 and we got it so don't need to check anything else . 4.check if it is divisible by 11 then its lpd is 11
I tried the above algorithm but i doubt that i have missed some numbers which are not prime and divisible by numbers other than 2 ,3,5,11 so if there is any such number which i have missed,it would be great if you add them.