OFFSET
0,2
COMMENTS
n is the a(n)-th nonnegative integer producing value A008904(n).
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..20000
EXAMPLE
a(11) = 3 because 11! = 39916800 is the third factorial with final nonzero digit 8 after 9! = 362880 and 10! = 3628800. A008904(k) = 8 for k = 9, 10, 11, ... .
PROG
(Python)
from functools import reduce
from itertools import count, islice
from collections import Counter
from sympy.ntheory.factor_ import digits
def A367799_gen(): # generator of terms
c = Counter()
for n in count(0):
c[m:=reduce(lambda x, y:x*y%10, (((6, 2, 4, 8, 6, 2, 4, 8, 2, 4, 8, 6, 6, 2, 4, 8, 4, 8, 6, 2)[(a<<2)|(i*a&3)] if i*a else (1, 1, 2, 6, 4)[a]) for i, a in enumerate(digits(n, 5)[-1:0:-1])), 6) if n>1 else 1]+=1
yield c[m]
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Alois P. Heinz, Dec 07 2023
STATUS
approved