User:Yeti: Difference between revisions
Content added Content deleted
(→Primes) |
|||
Line 9: | Line 9: | ||
</pre> |
</pre> |
||
=Primes= |
=Primes/Python/FSOE== |
||
==Python== |
|||
{{works with|Python|2.x}} |
{{works with|Python|2.x}} |
||
This is a sequentialised variant of the well known sieve method (ab)using a dictionary as sparse array. |
This is a sequentialised variant of the well known sieve method (ab)using a dictionary as sparse array. |
||
Line 20: | Line 19: | ||
if n in L: |
if n in L: |
||
P = L[n] |
P = L[n] |
||
del L[n] # optional - |
del L[n] # optional - saves some memory. |
||
else: |
else: |
||
print n |
print n |