login
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.
3
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,3
COMMENTS
Conjecture: a(n) != -1.
EXAMPLE
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.
MATHEMATICA
A383777[n_] := Length[NestWhileList[If[OddQ[#], # - FactorInteger[#][[1, 1]], 2*# + 1] &, n, # >0 &]] - 1;
Array[A383777, 100, 0] (* Paolo Xausa, May 22 2025 *)
PROG
(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
CROSSREFS
KEYWORD
nonn
AUTHOR
Ya-Ping Lu, May 17 2025
STATUS
approved