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.

This page as a plain text file.
%I A383777 #16 May 22 2025 06:52:54
%S A383777 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,
%T A383777 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,
%U A383777 9,10,1,2,11,4,1,4,1,2,5,10,5,2,1,6,3,6,1
%N 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.
%C A383777 Conjecture: a(n) != -1.
%H A383777 Paolo Xausa, <a href="/A383777/b383777.txt">Table of n, a(n) for n = 0..10000</a>
%e A383777 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.
%t A383777 A383777[n_] := Length[NestWhileList[If[OddQ[#], # - FactorInteger[#][[1,1]], 2*# + 1] &, n, # >0 &]] - 1;
%t A383777 Array[A383777, 100, 0] (* _Paolo Xausa_, May 22 2025 *)
%o A383777 (Python)
%o A383777 from sympy import primefactors; mp = lambda x: (0 if x ==1 else x - min(primefactors(x)) if x%2 else 2*x+1)
%o A383777 def A383777(n, c = 0):
%o A383777     while n != 0: n = mp(n); c += 1
%o A383777     return c
%Y A383777 Cf. A005408, A006577, A046666.
%K A383777 nonn
%O A383777 0,3
%A A383777 _Ya-Ping Lu_, May 17 2025