A238532 Number of distinct factorial numbers congruent to -1 (mod n).
0, 1, 1, 0, 1, 0, 2, 0, 0, 0, 2, 0, 1, 0, 0, 0, 1, 0, 2, 0, 0, 0, 3, 0, 1, 0, 0, 0, 2, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 4, 0, 4, 0, 0, 0, 0, 0, 3, 0, 0, 0, 7, 0, 1, 0, 0, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3, 0, 0, 0, 1, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0
Offset: 1
Keywords
Examples
There are two 6's in the 7th row of A062169. Therefore a(7)=2.
Links
Programs
-
Maple
A238532 := proc(n) local a,k ; a := 0 ; for k from 1 to n-1 do if modp(k!,n) = modp(-1,n) then a := a+1 ; end if; end do: a ; end proc: # R. J. Mathar, Apr 02 2014
-
PARI
A238532(n) = { my(m=1,s=0); for(k=1,oo,m *= k; if(!(m%n),return(s), if(1+(m%n)==n, s++))); }; \\ Antti Karttunen, May 24 2021
-
PARI
A238532(n) = { my(m=Mod(1,n),s=0,x); for(k=1,oo, m *= Mod(k,n); x = lift(m); if(!x,return(s), if(x==(n-1), s++))); }; \\ (Much faster than above program) - Antti Karttunen, May 24 2021
Comments