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.

A257081 a(n) = Number of iterations of A257080 needed, starting from n, before a fixed point is reached.

Original entry on oeis.org

0, 2, 1, 2, 0, 3, 1, 3, 1, 1, 2, 2, 0, 4, 2, 2, 0, 3, 0, 2, 3, 2, 0, 3, 1, 3, 1, 3, 1, 2, 1, 4, 1, 1, 7, 3, 1, 6, 1, 3, 2, 5, 1, 4, 1, 1, 2, 3, 0, 4, 2, 2, 0, 4, 2, 2, 9, 10, 4, 8, 0, 6, 3, 3, 0, 6, 0, 3, 6, 3, 0, 6, 0, 2, 2, 2, 0, 3, 2, 2, 2, 2, 1, 3, 0, 1, 3, 1, 0, 2, 0, 2, 2, 3, 0, 4, 0, 3, 8, 4, 0, 5, 6, 5, 3, 2, 6, 4, 0, 3, 1, 5, 0, 5, 0, 2, 2, 2, 0, 6, 1
Offset: 0

Views

Author

Antti Karttunen, Apr 15 2015

Keywords

Comments

Note: when at some point of iteration we reach some k whose factorial representation (A007623) does not contain any 1's, then at next step A257080(k) = 1*k, and thus a fixed point has been reached.

Examples

			For n = 5, with factorial representation A007623(5) = "21", the least missing nonzero digit is 3, thus A257080(5) = 3*5 = 15. 15 has factorial representation "211", so again we multiply by 3, resulting 3*15 = 45, with factorial representation "1311", thus the least missing nonzero digit is now 2, and 2*45 = 90, "3300" in factorial base, for which the least missing digit is 1, resulting 1*90 = 90 forever after, thus we have reached a fixed point after three iteration steps (5 -> 15 -> 45 -> 90) and a(5) = 3.
		

Crossrefs

A255411 gives the positions of zeros.

Programs

  • Scheme
    (define (A257081 n) (let loop ((oldn n) (n (A257080 n)) (s 1)) (if (= oldn n) s (loop n (A257080 n) (+ 1 s)))))
    ;; Alternative, recursive version, optionally using the memoizing definec-macro:
    (definec (A257081 n) (if (= 1 (A257079 n)) 0 (+ 1 (A257081 (A257080 n)))))

Formula

If A257079(n) = 1, a(n) = 0, otherwise, a(n) = 1 + a(A257080(n)).