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.

A257510 Number of nonleading zeros in factorial base representation of n (A007623).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Apr 27 2015

Keywords

Comments

Sequence starts from n=1, because 0 is an ambiguous case.

Crossrefs

Cf. A227157 (numbers n such that a(n) = 0), A227187 (n for which a(n) > 0).
Cf. also A257511.
Cf. also A023416, A080791 (analogous sequences for base-2), A055641 (for base-10).

Programs

  • Mathematica
    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 *)
  • 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)))))))

Formula

a(n) = A084558(n) - A060130(n).
Other identities and observations:
For all n >= 0, a(A000142(n+1)) = n. [(n+1)! gives the position where n first appears.]
For all n, a(n) >= A230403(n).