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
A124123 Primes not of the form nextprime(f(p)) with p prime, where f(p)=p/2 if p=2 (mod 3), f(p)=2p otherwise (cf. A138750).
5, 19, 61, 73, 83, 103, 107, 109, 113, 139, 151, 167, 173, 191, 199, 229, 269, 271, 277, 313, 337, 349, 359, 379, 397, 439, 463, 503, 523, 563, 571, 601, 607, 619, 733, 773, 823, 827, 829, 859, 883, 887, 911, 971, 983, 997, 1013, 1031, 1063, 1091, 1093, 1103
Offset: 1
Comments
These are the primes which cannot be part of a gb-sequence (except as seed).
Is this sequence finite or infinite?
From M. F. Hasler, Mar 27 2008: (Start)
The last comment above probably refers not to this sequence but to the "gb-sequences" themselves, e.g., the one starting with 4499221 which reaches a peak of approximately 10^110, cf. Formula and Links.
The function f(p)=p/2 if p == 2 (mod 3), f(p)=2p otherwise, yields a half-integer for primes p=6k-1 and an even number for primes p=6k+1; in all cases nextprime(f(p)) is defined without ambiguity: f(p) will never be equal to a prime.
This sequence lists primes p' not in the range of the map p -> nextprime(f(p)), defined on the primes.
Equivalently, p' is listed iff: (i) no even number between p' and the next lower prime is of the form 2p with p=0 or p == 1 (mod 3), AND (ii) no half-integer between p' and the next lower prime is of the form p/2 with p == 2 (mod 3) and p prime (in both conditions).
This characterization allows easy computation of the sequence, cf. PARI code.
Experimentally, it does not appear that this sequence is finite. Instead, its (local) density within the primes seems to increase, from roughly 25% for the first terms to about 50% at 10^30. (End)
The function f is discussed in A138750. Composed with the nextprime function and restricted to the primes (cf. A138751), it yields a ("natural") variant of the Collatz function on the set of the primes, with (mod 2) replaced by (mod 3). The gb-sequences are the orbits under that function. - M. F. Hasler, Nov 18 2018
Examples
Example: a(1) = 5 because there is no prime gb(n) such that gb(n+1) = 5.
References
- Communication paper by Georges Brougnard.
Links
- Vincenzo Librandi, Table of n, a(n) for n = 1..6470
- Georges Brougnard, Definition of GB-sequences.
- Georges Brougnard, GB-sequence of length 96, obtained for gb[0]=1381.
- Georges Brougnard, GB-sequence of length 63337, obtained for gb[0]=4499221.
Programs
-
Mathematica
lim = PrimePi[1000]; f[p_ /; Mod[p, 3] == 2] := p/2; f[p_] := 2*p; Complement[Prime[Range[lim]], Table[ NextPrime[ f[Prime[k]]], {k, 1, 2*lim}]] (* Jean-François Alcover, Sep 20 2011 *)
-
PARI
{forprime( p=3,10^3, for( i=precprime(p-1)+1,p, (2*i)%3==0 & isprime(2*i-1) & next(2); i%2==0 & ( i/2 )%3!=2 & isprime( i/2 ) & next(2)); print1( p", " ))} nextA124123(p)={ while( p=nextprime(p+1), for( i=precprime(p-1)+1,p, (2*i)%3==0 & isprime(2*i-1) & next(2); i%2==0 & ( i/2 )%3!=2 & isprime( i/2 ) & next(2)); return( p )) } t=2;vector(200,i,t=nextA124123(t)) \\ 60% of the first 200 terms are in 1+3Z: t=[0,0];vector(#%,i,t[%[i]%3]++);t \\ yields [120, 80] t=10^11;vector(200,i,t=nextA124123(t)) \\ exactly 50% of these terms are in 1+3Z: t=[0,0];vector(#%,i,t[%[i]%3]++);t \\ yields [100, 100] t=10^30;vector(200,i,t=nextA124123(t+1));t-10^30 \\ yields 31773 = distance of 200th term beyond 10^30 t=10^30;vector(200,i,t=nextprime(t+1));(t-1e30)/% \\ yields 0.52..., approx. local density in the primes. (End)
Formula
Recurrence for a gb-sequence starting with gb(0) = a prime > 2 (the seed):
| If gb(n) = 2 (mod 3) then gb(n+1) := least prime > gb(n)/2;
| otherwise gb(n+1) := least prime > gb(n)*2.
A gb-sequence of length L ends in the loop 7, 17, 11, 7, ... ; gb(L-1) = 7.
Extensions
Edited by M. F. Hasler, Mar 27 2008, Nov 18 2018
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
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))
A318759 Numbers x whose trajectory reaches 1 under recursive applications of the map x -> x/3 if x == 0 (mod 3), x -> (4*x+2)/3 if x == 1 (mod 3), x -> (4*x+1)/3 if x == 2 (mod 3).
1, 2, 3, 4, 6, 9, 12, 13, 18, 20, 27, 29, 36, 39, 40, 54, 60, 65, 81, 87, 108, 109, 117, 120, 121, 136, 146, 162, 180, 182, 195, 197, 243, 245, 261, 263, 272, 324, 327, 328, 332, 351, 360, 363
Offset: 1
Comments