A138753 Number of iterations of A138754 before reaching a number for the second time, when starting with n.
1, 4, 5, 3, 3, 5, 3, 8, 6, 4, 21, 17, 7, 7, 5, 5, 22, 24, 20, 18, 18, 16, 8, 6, 8, 6, 29, 23, 27, 23, 23, 21, 19, 19, 17, 21, 17, 15, 7, 7, 9, 60, 9, 9, 7, 30, 28, 26, 24, 26, 24, 24, 28, 24, 22, 20, 20, 22, 20, 18, 20, 18, 20, 18, 18, 16, 14, 12, 10, 12, 10, 61, 59, 55, 12, 10, 8, 31
Offset: 1
Keywords
Examples
a(1)=1 since after 1 step we find 1 again. a(4)=3 since 4 -> 7 -> 5 -> 4 under A138754.
Links
- Paolo Xausa, Table of n, a(n) for n = 1..1459 (terms 1..500 from M. F. Hasler)
- Georges Brougnard, Definition of GB-sequences.
- Index entries for sequences related to 3x+1 (or Collatz) problem
Crossrefs
Programs
Formula
A138756 Indices of record values in A138753 (a "prime" variation of the Collatz (3n+1) problem).
1, 2, 3, 8, 11, 17, 18, 27, 42, 72, 125, 219, 221, 401, 515, 556, 754, 841, 1146
Offset: 1
Comments
"Indices of ..." is equivalent to "starting values for ..."
Programs
-
Mathematica
A138754[n_]:=A138754[n]=With[{p=Prime[n]},PrimePi[NextPrime[If[Mod[p,3]==2,p/2,2p]]]]; A138753[n_]:=Length[NestWhileList[A138754,n,UnsameQ,{1,4}]]-1; A138756list[upto_]:=Module[{v,r=0},Table[If[(v=A138753[n])>r,r=v;n,Nothing],{n,upto}]]; A138756list[500] (* Paolo Xausa, Jul 30 2023 *)
-
PARI
m=0; for( i=1,#A138753, A138753[i] > m || next; m=A138753[i]; print1(i", "))
Formula
Extensions
a(15)-a(19) from Paolo Xausa, Jul 30 2023
Comments