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!.

Original entry on oeis.org

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, 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, 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
Offset: 0

Views

Author

Cezary Glowacz, Jun 25 2024

Keywords

Comments

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.
a(5^k) = 2^k mod 5.
From Cezary Glowacz, Feb 07 2025: (Start)
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).
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.
Consecutive terms 1,2,3 do not occur, so that triples do not have a similar equidistribution.
(End)
If n > 0 is not divisible by 5, a(n) == n * a(n-1) (mod 5). - Robert Israel, Jul 05 2024

Examples

			a(5) = 1*2*3*4*5/10 mod 5 = 2.
		

Crossrefs

Programs

  • Maple
    a:= n-> (f-> irem(f/10^padic[ordp](f, 10), 5))(n!):
    seq(a(n), n=0..105);  # Alois P. Heinz, Jun 25 2024
  • Mathematica
    a[n_]:=Mod[n!/10^IntegerExponent[n!, 10],5]; Array[a,106,0] (* Stefano Spezia, Jun 25 2024 *)
  • 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
  • Python
    v=[[((1,1,2,1,4)[j]*2**(i*j))%5 for j in range(5)] for i in range(4)]
    def a(n):
        c,p=0,1
        while n: c,n,p=(c+1)%4,n//5,(v[c][n%5]*p)%5
        return(p) # Cezary Glowacz, Feb 05 2025
    

Formula

a(n) = A010874(A004154(n)).