OFFSET
0,3
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.
Each residue modulo 5 except 0 occurs infinite number of times since a(5^k) = 2^k mod 5.
If n > 0 is not divisible by 5, a(n) == n * a(n-1) (mod 5). - Robert Israel, Jul 05 2024
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..20000
EXAMPLE
a(5) = 1*2*3*4*5/10 mod 5 = 2.
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 *)
PROG
(Python)
# prints the first 100 terms of the sequence
t=1
for i in range(100):
p=i if i else 1
while p%5==0:
p//=5
t*=3
t=(p*t)%5
print(t, end=', ')
CROSSREFS
KEYWORD
nonn
AUTHOR
Cezary Glowacz, Jun 25 2024
STATUS
approved