login
A112660
a(n) = (p-1)! mod p^2 where p = n-th prime.
2
1, 2, 24, 34, 10, 168, 84, 37, 183, 521, 588, 258, 655, 558, 281, 1801, 1592, 3415, 803, 4898, 802, 5766, 1659, 6229, 6789, 7271, 5870, 106, 3269, 10734, 9016, 15588, 7671, 9312, 14005, 12985, 23706, 17603, 3506, 18337, 8591, 13031, 30368, 6754, 28958, 23481, 36502, 40139
OFFSET
1,2
COMMENTS
Related to the Wilson primes A007540, which are primes p such that (p-1)! = -1 mod p^2.
LINKS
Claire Levaillant, Wilson's theorem modulo p^2 derived from Faulhaber polynomials, arXiv:1912.06652 [math.CO], 2019.
FORMULA
a(n) = A177771(n) mod A001248(n). - Michel Marcus, Dec 17 2019
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