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
A171938 Record values in A138753 (a "prime" variation of the Collatz (3n+1) problem).
1, 4, 5, 8, 21, 22, 24, 29, 60, 61, 72, 73, 97, 100, 184, 216, 239, 451, 469
Offset: 1
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; A171938list[upto_]:=Module[{v,r=0},Table[If[(v=A138753[n])>r,r=v,Nothing],{n,upto}]]; A171938list[500] (* Paolo Xausa, Jul 29 2023 *)
-
PARI
m=0; for( i=1,#A138753, A138753[i] > m & print1( m=A138753[i],", "))
Formula
Extensions
Originally submitted as A138755, but mislaid by Editor-in-Chief; renumbered and added to OEIS, Oct 24 2010
a(15)-a(19) from Paolo Xausa, Jul 29 2023
A138757 a(n) = A007918(A138750(n)), that is, least prime > n/2 if n=2 (mod 3), > 2n otherwise.
2, 2, 2, 7, 11, 3, 13, 17, 5, 19, 23, 7, 29, 29, 7, 31, 37, 11, 37, 41, 11, 43, 47, 13, 53, 53, 13, 59, 59, 17, 61, 67, 17, 67, 71, 19, 73, 79, 19, 79, 83, 23, 89, 89, 23, 97, 97, 29, 97, 101, 29, 103, 107, 29, 109, 113, 29, 127, 127, 31, 127, 127, 31, 127
Offset: 0
Comments
Examples
a(7) = 17 since 7 = 1 (mod 3), thus A138750(7) = 2*7 = 14, nextprime(14) = 17. a(11) = 7 since 11 = 2 (mod 3), thus A138750(11) = ceiling(11/2) = 6, nextprime(6) = 7.
Links
Programs
-
Mathematica
np1[n_]:=Module[{x=Ceiling[n/2]},If[PrimeQ[x],x,NextPrime[x]]]; np2[n_]:= Module[{x=2n},If[PrimeQ[x],x,NextPrime[x]]]; Table[If[Mod[n,3]==2, np1[n], np2[n]],{n,0,70}] (* Harvey P. Dale, Jul 10 2013 *)
-
PARI
A138757(n)=nextprime(if(n%3==2,(n+1)\2,2*n))
Comments