OFFSET
0,6
COMMENTS
In the factorial representation of n, given as {d_k, ..., d_3, d_2, d_1}, the maximal allowed digit for any position j is j. This sequence gives the number of digits in the whole representation [A007623(n)] that attain that maximum allowed value.
LINKS
FORMULA
EXAMPLE
For n=19, which has factorial representation "301", the digits at position 1 and 3, namely "1" and "3" are equal to their one-based position index, in other words, the maximal digits allowed in those positions (while "0" at position 2 is not), thus a(19) = 2.
MATHEMATICA
a[n_] := Module[{k = n, m = 2, c = 0, r}, While[{k, r} = QuotientRemainder[k, m]; k != 0 || r != 0, If[r == m - 1, c++]; m++]; c]; Array[a, 100, 0] (* Amiram Eldar, Jan 23 2024 *)
PROG
(Scheme, with memoization-macro definec)
(Python)
from sympy import factorial as f
def a007623(n, p=2): return n if n<p else a007623(n//p, p+1)*10 + n%p
def a257684(n):
x=str(a007623(n))[:-1]
y="".join(str(int(i) - 1) if int(i)>0 else '0' for i in x)[::-1]
return 0 if n==1 else sum(int(y[i])*f(i + 1) for i in range(len(y)))
def a(n): return 0 if n==0 else n%2 + a(a257684(n))
print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 20 2017
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Aug 27 2015
STATUS
approved