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.

A297025 Number of iterations of A220096 required to reach 0 starting from n.

Original entry on oeis.org

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

Views

Author

Peter Kagey and Alec Jones, Dec 24 2017

Keywords

Comments

Records occur at indices 0, 1, 2, 3, 5, 7, 11, 22, 23, 46, 47, 94, ... (see A297026).

Examples

			For n = 14, a(14) = 6 because six iterations are required to reach zero:
A220096(14) = 7,
A220096(7)  = 6,
A220096(6)  = 3,
A220096(3)  = 2,
A220096(2)  = 1, and
A220096(1)  = 0.
		

Crossrefs

Cf. A220096. Positions of records at A297026.

Programs

  • Mathematica
    g[n_Integer] := If[n == 1, 0, Block[{fi = FactorInteger@ n}, If[Plus @@ (Last@# & /@ FactorInteger@n) == 1, n -1, n/fi[[1, 1]] ]]]; f[n_] := Length@ NestWhileList[g, n, # > 0 &] -1; Array[f, 86, 0] (* Robert G. Wilson v, Dec 24 2017 *)
  • PARI
    f(n) = if (n==1, 0, isprime(n), n-1, my(d=divisors(n)); d[#d-1]);
    a(n) = my(nb = 0); while (n, n = f(n); nb++); nb; \\ Michel Marcus, Dec 24 2017