Penta-power prime seeds: Difference between revisions
Content added Content deleted
(lang -> syntaxhighlight) |
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
||
Line 29: | Line 29: | ||
NB: The source of the ALGOL 68-primes library is on a Rosetta Code code page linked from the above.<br> |
NB: The source of the ALGOL 68-primes library is on a Rosetta Code code page linked from the above.<br> |
||
Note that to run this with ALGOL 68G under Windows (and probably Linux) a large heap size must be specified on the command line, e.g. <code>-heap 1024M</code>. |
Note that to run this with ALGOL 68G under Windows (and probably Linux) a large heap size must be specified on the command line, e.g. <code>-heap 1024M</code>. |
||
<syntaxhighlight lang=algol68>BEGIN # find some Penta power prime seeds, numbers n such that: # |
<syntaxhighlight lang="algol68">BEGIN # find some Penta power prime seeds, numbers n such that: # |
||
# n^p + n + 1 is prime for p = 0. 1, 2, 3, 4 # |
# n^p + n + 1 is prime for p = 0. 1, 2, 3, 4 # |
||
PR read "primes.incl.a68" PR # include prime utilities # |
PR read "primes.incl.a68" PR # include prime utilities # |
||
Line 126: | Line 126: | ||
=={{header|Factor}}== |
=={{header|Factor}}== |
||
{{works with|Factor|0.99 2022-04-03}} |
{{works with|Factor|0.99 2022-04-03}} |
||
<syntaxhighlight lang=factor>USING: grouping io kernel lists lists.lazy math math.functions |
<syntaxhighlight lang="factor">USING: grouping io kernel lists lists.lazy math math.functions |
||
math.primes prettyprint tools.memory.private ; |
math.primes prettyprint tools.memory.private ; |
||
Line 149: | Line 149: | ||
=={{header|Phix}}== |
=={{header|Phix}}== |
||
<!--<syntaxhighlight lang= |
<!--<syntaxhighlight lang="phix">(phixonline)--> |
||
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span> |
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span> |
||
<span style="color: #008080;">include</span> <span style="color: #004080;">mpfr</span><span style="color: #0000FF;">.</span><span style="color: #000000;">e</span> |
<span style="color: #008080;">include</span> <span style="color: #004080;">mpfr</span><span style="color: #0000FF;">.</span><span style="color: #000000;">e</span> |
||
Line 210: | Line 210: | ||
=={{header|Raku}}== |
=={{header|Raku}}== |
||
<syntaxhighlight lang= |
<syntaxhighlight lang="raku" line>use Lingua::EN::Numbers; |
||
my @ppps = lazy (^∞).hyper(:5000batch).map(* × 2 + 1).grep: -> \n { my \k = n + 1; (1+k).is-prime && (n+k).is-prime && (n²+k).is-prime && (n³+k).is-prime && (n⁴+k).is-prime } |
my @ppps = lazy (^∞).hyper(:5000batch).map(* × 2 + 1).grep: -> \n { my \k = n + 1; (1+k).is-prime && (n+k).is-prime && (n²+k).is-prime && (n³+k).is-prime && (n⁴+k).is-prime } |
||
Line 244: | Line 244: | ||
{{libheader|Wren-gmp}} |
{{libheader|Wren-gmp}} |
||
{{libheader|Wren-fmt}} |
{{libheader|Wren-fmt}} |
||
<syntaxhighlight lang=ecmascript>import "./gmp" for Mpz |
<syntaxhighlight lang="ecmascript">import "./gmp" for Mpz |
||
import "./fmt" for Fmt |
import "./fmt" for Fmt |
||