OFFSET
1,2
COMMENTS
Related to the Wilson primes A007540, which are primes p such that (p-1)! = -1 mod p^2.
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..1000
Claire Levaillant, Wilson's theorem modulo p^2 derived from Faulhaber polynomials, arXiv:1912.06652 [math.CO], 2019.
FORMULA
MAPLE
seq(`mod`(factorial(ithprime(n)-1), ithprime(n)^2), n = 1..50); # G. C. Greubel, Dec 17 2019
MATHEMATICA
Table[Mod[(Prime[n]-1)!, Prime[n]^2], {n, 50}] (* G. C. Greubel, Dec 17 2019 *)
PROG
(PARI) a(n) = my(p=prime(n)); (p-1)! % p^2; \\ Michel Marcus, Dec 17 2019
(Magma) [Factorial(NthPrime(n)-1) mod NthPrime(n)^2 : n in [1..50]]; // G. C. Greubel, Dec 17 2019
(Sage) [mod(factorial(nth_prime(n)-1), nth_prime(n)^2) for n in (1..50)] # G. C. Greubel, Dec 17 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Roger Hui, Dec 28 2005
EXTENSIONS
Offset 1 and more terms from Michel Marcus, Dec 17 2019
STATUS
approved