login
n! mod tetrahedral(n), that is A000142(n) mod A000292(n).
2

%I #11 Dec 07 2019 12:18:26

%S 0,2,6,4,15,48,0,0,45,120,66,168,0,0,120,288,153,360,0,0,231,528,0,0,

%T 0,0,378,840,435,960,0,0,0,0,630,1368,0,0,780,1680,861,1848,0,0,1035,

%U 2208,0,0,0,0,1326,2808,0,0,0,0,1653,3480,1770,3720,0,0,0,0,2145,4488

%N n! mod tetrahedral(n), that is A000142(n) mod A000292(n).

%H Ivan Neretin, <a href="/A226718/b226718.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = n! mod (n*(n+1)*(n+2)/6).

%F For n>4: if neither n+1 nor n+2 is prime, then a(n)=0. Otherwise, a(n)=n(n+1)/2 for odd n and a(n)=n(n+2) for even n. - _Ivan Neretin_, May 18 2015

%p A226718 := proc(n)

%p n! mod ( n*(n+1)*(n+2)/6) ;

%p end proc: # _R. J. Mathar_, Jun 18 2013

%t Table[Mod[n!, n (n + 1) (n + 2)/6], {n, 66}] (* _Ivan Neretin_, May 18 2015 *)

%o (Python)

%o f = 1

%o for i in range(1, 100):

%o f *= i

%o print str(f % (i*(i+1)*(i+2)/6))+',',

%Y Cf. A000142, A000292, A119690.

%K nonn,easy

%O 1,2

%A _Alex Ratushnyak_, Jun 15 2013