4 ms·
That's more accurately described as memoization, as caching is a broader term. Also, you might want to look into Sieve of Eratosthenes, as you only have to tes
by AncientPC 14y ago
That's more accurately described as memoization, as caching is a broader term.
Also, you might want to look into Sieve of Eratosthenes, as you only have to test up to sqrt(n) for primality:
https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
- foxhop 14y agoThank you, AncientPC. I have adjusted the article with the insight you and many others have provided me.