OFFSET
1,2
COMMENTS
It appears that a(1)=1, a(2)=2, a(3)=6, and, for n>3, a(n) = n*(n+2) if n+1 is prime, else a(n) = n*(n+1)*(n+5)/6 if n+2 is prime, else a(n)=0. This has been verified for n up to 1000.
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..1000
MATHEMATICA
Table[Mod[(n!), (n^3 + 3 n^2 + 2 n)/3], {n, 100}] (* Vincenzo Librandi, Jul 10 2014 *)
PROG
(PARI) a(n) = n! % (n*(n+1)*(n+2)/3); \\ Michel Marcus, Jul 09 2014
(Magma)
[Factorial(n) mod (2*Binomial(n+2, 3)): n in [1..80]]; // G. C. Greubel, Apr 12 2024
(SageMath)
[factorial(n)%(2*binomial(n+2, 3)) for n in range(1, 81)] # G. C. Greubel, Apr 12 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
John W. Layman, Jul 27 2010
STATUS
approved