# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/
Search: id:a238532
Showing 1-1 of 1
%I A238532 #39 May 24 2021 23:31:46
%S A238532 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,
%T A238532 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,
%U A238532 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
%N A238532 Number of distinct factorial numbers congruent to -1 (mod n).
%C A238532 Number of solutions to k! == -1 (mod n), k>=1.
%C A238532 Counts the frequency of the value n-1 in the n-th row of triangle A062169.
%C A238532 Values 1..9 occur for the first time at n = 2, 7, 23, 59, 227, 401, 71, 3643, 62939, which are all prime numbers (see also A230315). Sequence A256519 gives composite k for which a(k) > 0. - _Antti Karttunen_, May 24 2021
%H A238532 Antti Karttunen, Table of n, a(n) for n = 1..65537
%H A238532 Index entries for sequences related to factorial numbers
%e A238532 There are two 6's in the 7th row of A062169. Therefore a(7)=2.
%p A238532 A238532 := proc(n)
%p A238532 local a,k ;
%p A238532 a := 0 ;
%p A238532 for k from 1 to n-1 do
%p A238532 if modp(k!,n) = modp(-1,n) then
%p A238532 a := a+1 ;
%p A238532 end if;
%p A238532 end do:
%p A238532 a ;
%p A238532 end proc: # _R. J. Mathar_, Apr 02 2014
%o A238532 (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
%o A238532 (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
%Y A238532 Cf. A000142, A049046, A062169, A230315, A256519.
%K A238532 nonn
%O A238532 1,7
%A A238532 _R. J. Mathar_, Apr 02 2014
# Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE