Wilson primes of order n: Difference between revisions

→‎{{header|Raku}}: Over the top we go
(julia example)
(→‎{{header|Raku}}: Over the top we go)
Line 158:
 
=={{header|Raku}}==
<lang perl6># Factorial
<lang perl6>sub postfix:<!> (Int $n) { (constant f = 1, |[\×] 1..*)[$n] }
 
# Invisible times
sub infix:<⁢> is tighter(&infix:<**>) { $^a * $^b };
 
# Prime the iterator for thread safety
sink 11000!;
 
my @primes = ^1.1e4 .grep: *.is-prime;
Line 166 ⟶ 173:
────────────────────';
 
.say for (1..40).hyper(:1batch).map: -> \𝒏 {
-> \n { printf sprintf "%3d: %s\n", n𝒏, @primes.grep( -> \p𝒑 { (p𝒑n𝒏) && ((n𝒏 - 1)! × (p𝒑 - n𝒏)! - (-1) ** n𝒏) %% p𝒑² } ).Str } for 1..11;</lang>
}</lang>
{{out}}
<pre> n: Wilson primes
Line 180 ⟶ 189:
9: 541
10: 11 1109
11: 17 2713</pre>
12:
13: 13
14:
15: 349
16: 31
17: 61 251 479
18:
19: 71
20: 59 499
21:
22:
23:
24: 47 3163
25:
26:
27: 53
28: 347
29:
30: 137 1109 5179
31:
32: 71
33: 823 1181 2927
34: 149
35: 71
36:
37: 71 1889
38:
39: 491
40: 59 71 1171</pre>
 
=={{header|REXX}}==
10,327

edits