www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Is prime missing in photos?

reply Andre Pany <andre s-e-a-p.de> writes:
Hi,
Does Phobos have an isPrime function? I cannot find it in the 
library. I currently have a look at projecteuler.net problem no 
7. Such a function makes it a lot easier to solve the problem.

https://projecteuler.net/problem=7

Kind regards
Andre
Sep 29
parent Elronnd <elronnd em.slashem.me> writes:
Well the purpose of the exercise kind of *is* to write a prime 
number generator.  You can look up prime number sieves and 
algorithms.  For REALLY large numbers, that takes an insane 
amount of time, and you can instead use algorithms such as the 
ones outlined at 
https://csrc.nist.gov/csrc/media/publications/fips/186/3/archive/2009-06-25/docu
ents/fips_186-3.pdf (appendix C.3)
Sep 29