Sequence of primes by trial division: Difference between revisions
Sequence of primes by trial division (view source)
Revision as of 19:45, 14 February 2023
, 1 year ago→bc: add
(→Fun With Lists: fix, simplify, massiv speed-up) |
(→bc: add) |
||
Line 547:
280: 1823 1831 1847 1861 1867 1871 1873 1877 1879 1889
</pre>
=={{header|bc}}==
<syntaxhighlight lang="bc">l = 100
a[0] = 2
a[o = 1] = 3
for (n = 5; n < l; n += 2) {
for (i = 1; n % (p = a[i]) != 0; ++i) {
if (p * p > n) {
a[++o] = n
break
}
}
}
for (i = 0; i <= o; ++i) a[i]</syntaxhighlight>
=={{header|Befunge}}==
|