Primes: n*2^m+1: Difference between revisions
Content added Content deleted
SqrtNegInf (talk | contribs) (Added Perl) |
(→{{header|ALGOL 68}}: blurb tweak) |
||
Line 17: | Line 17: | ||
=={{header|ALGOL 68}}== |
=={{header|ALGOL 68}}== |
||
{{works with|ALGOL 68G| |
{{works with|ALGOL 68G|2 or 3 - Tested with release 3.0.3 under Windows}} |
||
{{libheader|ALGOL 68-primes}} |
|||
Attempts the stretchier stretch goal - with 2000 digit precision and restricting m to at most 600, all of the first 400 primes can be found, except for 383. Increasing the number of digits and max n to 8000 should find prime 383, however I couldn't be bothered to wait long enough...<br> |
Attempts the stretchier stretch goal - with 2000 digit precision and restricting m to at most 600, all of the first 400 primes can be found, except for 383. Increasing the number of digits and max n to 8000 should find prime 383, however I couldn't be bothered to wait long enough...<br> |
||
The values of the primes are interesting - most will fit in 64 bits |
The values of the primes are interesting - most will fit in 64 bits but there are a small number that have hundreds or thousands of digits. <br> |
||
<b>NB</b> the primes.incl.a68 source is available on a page in Rosetta Code - see the <b>library</b> above. |
|||
<syntaxhighlight lang="algol68"> |
<syntaxhighlight lang="algol68"> |
||
BEGIN # find primes of the form 1+n*2^m where m is the lowest integer >= 0 # |
BEGIN # find primes of the form 1+n*2^m where m is the lowest integer >= 0 # |