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.

A383777 a(n) is the number of steps that n requires to reach 0 under the map: x -> 2*x + 1 if x is even; 0 if x = 1; x - lpf(x) otherwise where lpf(x) is the least prime factor of x. a(n) = -1 if 0 is never reached.

Original entry on oeis.org

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

Views

Author

Ya-Ping Lu, May 17 2025

Keywords

Comments

Conjecture: a(n) != -1.

Examples

			a(10) = 4 because it takes 4 steps for 10 to reach 1 by iterating the map: 10 -> 2*10+1=21 -> 21-3=18 -> 2*18+1=37 -> 37-37=0.
		

Crossrefs

Programs

  • Mathematica
    A383777[n_] := Length[NestWhileList[If[OddQ[#], # - FactorInteger[#][[1,1]], 2*# + 1] &, n, # >0 &]] - 1;
    Array[A383777, 100, 0] (* Paolo Xausa, May 22 2025 *)
  • Python
    from sympy import primefactors; mp = lambda x: (0 if x ==1 else x - min(primefactors(x)) if x%2 else 2*x+1)
    def A383777(n, c = 0):
        while n != 0: n = mp(n); c += 1
        return c