Penta-power prime seeds: Difference between revisions

lang -> syntaxhighlight
(Add Factor)
(lang -> syntaxhighlight)
Line 29:
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>.
<langsyntaxhighlight 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 #
PR read "primes.incl.a68" PR # include prime utilities #
Line 104:
)
OD
END</langsyntaxhighlight>
{{out}}
<pre>
Line 126:
=={{header|Factor}}==
{{works with|Factor|0.99 2022-04-03}}
<langsyntaxhighlight lang=factor>USING: grouping io kernel lists lists.lazy math math.functions
math.primes prettyprint tools.memory.private ;
 
Line 136:
 
"First thirty penta-power prime seeds:" print
30 pentas ltake list>array 5 group simple-table.</langsyntaxhighlight>
{{out}}
<pre>
Line 149:
 
=={{header|Phix}}==
<!--<langsyntaxhighlight lang=Phix>(phixonline)-->
<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>
Line 188:
<span style="color: #008080;">end</span> <span style="color: #008080;">while</span>
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"First penta-power prime seed greater than:\n%s"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">l</span><span style="color: #0000FF;">)</span>
<!--</langsyntaxhighlight>-->
{{out}}
<pre>
Line 210:
 
=={{header|Raku}}==
<langsyntaxhighlight lang=perl6>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 }
Line 222:
my $key = @ppps.first: * > $threshold, :k;
say "{$threshold.&cardinal.fmt: '%13s'} is the {ordinal-digit $key + 1}: {@ppps[$key].&comma}";
}</langsyntaxhighlight>
{{out}}
<pre>First thirty penta-power prime seeds:
Line 244:
{{libheader|Wren-gmp}}
{{libheader|Wren-fmt}}
<langsyntaxhighlight lang=ecmascript>import "./gmp" for Mpz
import "./fmt" for Fmt
 
Line 283:
}
n = n + 2
}</langsyntaxhighlight>
 
{{out}}
3,028

edits