Popular recipes tagged "primes" and "numbers" but not "generator"http://code.activestate.com/recipes/tags/primes+numbers-generator/2011-11-05T23:42:37-07:00ActiveState Code RecipesprimeList (Python)
2011-11-05T23:42:37-07:00Alexander James Wallarhttp://code.activestate.com/recipes/users/4179768/http://code.activestate.com/recipes/577935-primelist/
<p style="color: grey">
Python
recipe 577935
by <a href="/recipes/users/4179768/">Alexander James Wallar</a>
(<a href="/recipes/tags/list/">list</a>, <a href="/recipes/tags/numbers/">numbers</a>, <a href="/recipes/tags/prime/">prime</a>, <a href="/recipes/tags/primelist/">primelist</a>, <a href="/recipes/tags/primes/">primes</a>, <a href="/recipes/tags/theory/">theory</a>).
Revision 3.
</p>
<p>This module returns all the prime numbers strictly less than n. For this code to print out all of the primes n inclusive, in the range, n+1 must be substituted for n.</p>
Fastest way to list all primes below N in python (Python)
2010-07-27T01:57:20-07:00robert.william.hankshttp://code.activestate.com/recipes/users/4174481/http://code.activestate.com/recipes/577331-fastest-way-to-list-all-primes-below-n-in-python/
<p style="color: grey">
Python
recipe 577331
by <a href="/recipes/users/4174481/">robert.william.hanks</a>
(<a href="/recipes/tags/fast/">fast</a>, <a href="/recipes/tags/fastest/">fastest</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/numbers/">numbers</a>, <a href="/recipes/tags/numpy/">numpy</a>, <a href="/recipes/tags/primes/">primes</a>, <a href="/recipes/tags/python/">python</a>).
Revision 6.
</p>
<p>I was looking for a fast way to list all primes below n,
so far i came up to this with the numpy solution the fastest.
It does primes up to 10e6 in 15ms in my old machine,
and it is capable of reaching 10e9. </p>
Infinite list of primes! Yay! (Python)
2010-07-20T04:05:00-07:00Alejandro Peraltahttp://code.activestate.com/recipes/users/4174433/http://code.activestate.com/recipes/577318-infinite-list-of-primes-yay/
<p style="color: grey">
Python
recipe 577318
by <a href="/recipes/users/4174433/">Alejandro Peralta</a>
(<a href="/recipes/tags/iterators/">iterators</a>, <a href="/recipes/tags/numbers/">numbers</a>, <a href="/recipes/tags/primes/">primes</a>).
</p>
<p>It's an iterator that returns prime numbers. </p>
<p>Got the idea from here: <a href="http://www.cs.hmc.edu/%7Eoneill/papers/Sieve-JFP.pdf" rel="nofollow">www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf</a></p>
Prime, Perfect and Fibonacci Number Widget Class (Python)
2010-05-19T17:02:28-07:00AJ. Mayorgahttp://code.activestate.com/recipes/users/4173476/http://code.activestate.com/recipes/577229-prime-perfect-and-fibonacci-number-widget-class/
<p style="color: grey">
Python
recipe 577229
by <a href="/recipes/users/4173476/">AJ. Mayorga</a>
(<a href="/recipes/tags/cryptography/">cryptography</a>, <a href="/recipes/tags/numbers/">numbers</a>, <a href="/recipes/tags/prime/">prime</a>, <a href="/recipes/tags/primes/">primes</a>).
Revision 2.
</p>
<p>A class Ive had in my snippets for awhile that can generate prime, perfect and fibonacci sequences as well as check whether or not a supplied value is any of them.</p>