cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A374015 Residue modulo 5 of n! divided by the highest power of 10 which divides n!.

This page as a plain text file.
%I A374015 #114 Apr 28 2025 09:03:22
%S A374015 1,1,2,1,4,2,2,4,2,3,3,3,1,3,2,3,3,1,3,2,4,4,3,4,1,4,4,3,4,1,3,3,1,3,
%T A374015 2,2,2,4,2,3,2,2,4,2,3,1,1,2,1,4,2,2,4,2,3,4,4,3,4,1,1,1,2,1,4,1,1,2,
%U A374015 1,4,3,3,1,3,2,4,4,3,4,1,3,3,1,3,2,2,2,4,2,3,2,2,4,2,3,1,1,2,1,4,4,4,3,4,1,3
%N A374015 Residue modulo 5 of n! divided by the highest power of 10 which divides n!.
%C A374015 The sequence is not eventually periodic. This because by induction on k the eventual period must be a multiple of 5^k for every k.
%C A374015 a(5^k) = 2^k mod 5.
%C A374015 From _Cezary Glowacz_, Feb 07 2025: (Start)
%C A374015 The proportions p(m,s) of counts of pairs of consecutive terms s among a(1),...,a(m) converge to equidistribution (and as an immediate consequence, so do proportions of individual terms).
%C A374015 This can be seen, for example, by stating p(5^(4(n+1)+1)-1,s) as affine functions of p(5^(4n+1)-1,t) and examining the convergence of p(5^(4n+1)-1,u) to the equidistribution. Then, p(m,s) converges to the equidistribution because the maximum over s of the absolute values of deviations from 1/16 of p(m,s) for m>k*5^(4n+1)-1 is less than the corresponding maximum over t for p(5^(4n+1)-1,t) plus 2/(5^(4n+1)) + 1/k.
%C A374015 Consecutive terms 1,2,3 do not occur, so that triples do not have a similar equidistribution.
%C A374015 (End)
%C A374015 If n > 0 is not divisible by 5, a(n) == n * a(n-1) (mod 5). - _Robert Israel_, Jul 05 2024
%H A374015 Alois P. Heinz, <a href="/A374015/b374015.txt">Table of n, a(n) for n = 0..20000</a>
%F A374015 a(n) = A010874(A004154(n)).
%e A374015 a(5) = 1*2*3*4*5/10 mod 5 = 2.
%p A374015 a:= n-> (f-> irem(f/10^padic[ordp](f, 10), 5))(n!):
%p A374015 seq(a(n), n=0..105);  # _Alois P. Heinz_, Jun 25 2024
%t A374015 a[n_]:=Mod[n!/10^IntegerExponent[n!, 10],5]; Array[a,106,0] (* _Stefano Spezia_, Jun 25 2024 *)
%o A374015 (Python)
%o A374015 v=[[((1,1,2,1,4)[j]*2**(i*j))%5 for j in range(5)] for i in range(4)]
%o A374015 def a(n):
%o A374015     c,p=0,1
%o A374015     while n: c,n,p=(c+1)%4,n//5,(v[c][n%5]*p)%5
%o A374015     return(p) # _Cezary Glowacz_, Feb 05 2025
%o A374015 (PARI) a(n)=if(n>4, my(k=n\5); return(lift((n%5)!*a(k)*Mod(2,5)^k))); n!%5 \\ _Charles R Greathouse IV_, Jan 24 2025
%Y A374015 Cf. A004154, A010874, A145679.
%Y A374015 Cf. A045549, A045547, A045550, A045548.
%K A374015 nonn,easy
%O A374015 0,3
%A A374015 _Cezary Glowacz_, Jun 25 2024