func is_wilson_prime(p, n =1) { var m =p*p (factorialmod(n-1, m) * factorialmod(p-n, m) - (-1)**n) % m ==0}var primes =1.1e4.primessay " n: Wilson primes\n────────────────────"for n in (1..11) {printf("%3d: %s\n", n, primes.grep {|p| is_wilson_prime(p, n) })}