I coded this algo last hour and I don't know is it really works or not. How to be assure that is really Generating real prime number. As far as i check manually it was prime. i need to Generate prime 1-1000000000 where difference is 1000000 so it is a good method to get primes isn't it.
oh great i i .... dont know how much prime there are in 1 and 1,000,000,000 but after your post i just Google it and got there are 50,847,534 prime so it means my code works. But do you have any idea to run it faster for a huge number like 1,000,000,000.
As far as i get the fastest method of generating prime is Sieve of Atkin and i implement it from the Pseudocode provided on Wikipedia but that code work from 1 to X and because none of array can handle more than 1,000,000 element it fail with the number 1,000,000,000.