Least m such that n! + m is prime: Difference between revisions

Content added Content deleted
m (→‎{{header|Raku}}: twiddles)
Line 36: Line 36:
my @least-m = lazy (^∞).hyper(:2batch).map: {(1..*).first: -> \n {(@f[$_] + n).is-prime}};
my @least-m = lazy (^∞).hyper(:2batch).map: {(1..*).first: -> \n {(@f[$_] + n).is-prime}};


say "Least m such that n! + m is prime; first fifty:\n"
say "Least positive m such that n! + m is prime; first fifty:\n"
~ @least-m[^50].batch(10)».fmt("%3d").join: "\n";
~ @least-m[^50].batch(10)».fmt("%3d").join: "\n";


Line 44: Line 44:
}</syntaxhighlight>
}</syntaxhighlight>
{{out}}
{{out}}
<pre>Least m such that n! + m is prime; first fifty:
<pre>Least positive m such that n! + m is prime; first fifty:
1 1 1 1 5 7 7 11 23 17
1 1 1 1 5 7 7 11 23 17
11 1 29 67 19 43 23 31 37 89
11 1 29 67 19 43 23 31 37 89