%I #18 Apr 30 2015 21:46:26
%S 0,1,0,1,0,2,1,1,0,1,0,2,1,1,0,1,0,2,1,1,0,1,0,3,2,2,1,2,1,2,1,1,0,1,
%T 0,2,1,1,0,1,0,2,1,1,0,1,0,3,2,2,1,2,1,2,1,1,0,1,0,2,1,1,0,1,0,2,1,1,
%U 0,1,0,3,2,2,1,2,1,2,1,1,0,1,0,2,1,1,0,1,0,2,1,1,0,1,0,3,2,2,1,2,1,2,1,1,0,1,0,2,1,1,0,1,0,2,1,1,0,1,0,4
%N Number of nonleading zeros in factorial base representation of n (A007623).
%C Sequence starts from n=1, because 0 is an ambiguous case.
%H Antti Karttunen, <a href="/A257510/b257510.txt">Table of n, a(n) for n = 1..10080</a>
%F a(n) = A084558(n) - A060130(n).
%F Other identities and observations:
%F For all n >= 0, a(A000142(n+1)) = n. [(n+1)! gives the position where n first appears.]
%F For all n, a(n) >= A230403(n).
%t factBaseIntDs[n_] := Module[{m, i, len, dList, currDigit}, i = 1; While[n > i!, i++]; m = n; len = i; dList = Table[0, {len}]; Do[currDigit = 0; While[m >= j!, m = m - j!; currDigit++]; dList[[len - j + 1]] = currDigit, {j, i, 1, -1}]; If[dList[[1]] == 0, dList = Drop[dList, 1]]; dList]; s = Table[FromDigits[factBaseIntDs[n]], {n, 120}]; Last@ DigitCount[#] & /@ s (* _Michael De Vlieger_, Apr 27 2015, after _Alonso del Arte_ at A007623 *)
%o (Scheme) (define (A257510 n) (let loop ((n n) (i 2) (s 0)) (cond ((zero? n) s) (else (loop (floor->exact (/ n i)) (+ 1 i) (+ s (if (zero? (modulo n i)) 1 0)))))))
%Y Cf. A227157 (numbers n such that a(n) = 0), A227187 (n for which a(n) > 0).
%Y Cf. A007623, A060130, A084558, A230403.
%Y Cf. also A257511.
%Y Cf. also A023416, A080791 (analogous sequences for base-2), A055641 (for base-10).
%K nonn,base
%O 1,6
%A _Antti Karttunen_, Apr 27 2015