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.

A348340 For n >= 1; x = n, then iterate x --> x + h(x) until h(x + h(x)) >= h(x). a(n) gives the number of iteration steps where h(i) is A000120(i).

Original entry on oeis.org

5, 4, 3, 3, 2, 1, 1, 4, 3, 3, 2, 2, 1, 1, 1, 7, 6, 6, 5, 5, 1, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1, 7, 6, 6, 5, 5, 1, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1, 5, 3, 4, 2, 2, 3, 3, 1, 2, 2, 2, 1, 1, 1, 1, 1, 7, 6, 6, 5, 5, 1, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1, 5, 3, 4, 2, 2, 3, 3, 1, 2, 2, 2, 1, 1, 1, 1, 1, 5, 3, 4, 2, 2, 3, 4, 1, 2, 2, 3, 1, 1, 1, 2
Offset: 1

Views

Author

Ctibor O. Zizka, Oct 13 2021

Keywords

Comments

a(n) = 1 for n such that A000120(n + A000120(n)) < A000120(n).

Examples

			n = 19; x(1) = 19 + h(19) = 22, h(22) >= h(19) thus x(2) = 22 + h(22) = 25, h(25) >= h(22) thus x(3) = 25 + h(25) = 28, h(28) >= h(25) thus x(4) = 28 + h(28) = 31, h(31) >= h(28) thus x(5) =  31 + h(31) = 36, h(36) < h(31) thus stop. a(19) = 5. h(i) is A000120(i).
		

Crossrefs

Programs

  • Mathematica
    h[n_] := DigitCount[n, 2, 1]; x[n_] := n + h[n]; a[n_] := Length@ NestWhileList[x, n, h[#] <= h[x[#]] &]; Array[a, 110] (* Amiram Eldar, Oct 15 2021 *)