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.

Showing 1-5 of 5 results.

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).

Original entry on oeis.org

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

Views

Author

Jacques Tramu, Dec 13 2006

Keywords

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.

Crossrefs

Cf. A007918 (nextprime), A138750 (function f), A138751, A138752, A138753, A138754.

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

Complement of A007918(A138750(A000040)) = nextprime(f({primes})).
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

A138750 a(n) = ceiling(n/2) if n == 2 (mod 3), a(n) = 2n otherwise.

Original entry on oeis.org

0, 2, 1, 6, 8, 3, 12, 14, 4, 18, 20, 6, 24, 26, 7, 30, 32, 9, 36, 38, 10, 42, 44, 12, 48, 50, 13, 54, 56, 15, 60, 62, 16, 66, 68, 18, 72, 74, 19, 78, 80, 21, 84, 86, 22, 90, 92, 24, 96, 98, 25, 102, 104, 27, 108, 110, 28, 114, 116, 30, 120, 122, 31, 126, 128, 33, 132, 134, 34
Offset: 0

Views

Author

M. F. Hasler, Mar 28 2008

Keywords

Comments

This map is inspired by A124123, which hides in fact a variation of the Collatz problem, defined on the set of primes and working mod 3 instead of mod 2. See A138751 for more information.
The use of ceiling() is here equivalent to round().
The main reason for defining this function is to write A124123 as complement of A007918(A138750(A000040)), and to express the recursion function occurring there in terms of this map.
It might have been more natural to define this map as a(n) = 2n if n == 1 (mod 3), a(n) = ceiling(n/2) otherwise, which is equivalent for all primes > 3 (which are either == 1 or == 2 (mod 3)) and would have "better" properties regarding the analysis of orbits of all integers under this map.
However, for the prime n=3 it does make a difference, and in order to reproduce the map occurring in A124123, we had to adopt the present convention.

Examples

			a(0) = 2*0 = 0, a(1) = 2*1 = 2, a(3) = 2*3 = 6, a(4) = 2*4 = 8, ... since these indices are not congruent to 2 (mod 3).
a(2) = ceiling(2/2) = 1, a(5) = ceiling(5/2) = 3, a(8) = ceiling(8/2) = 4, a(11) = ceiling(11/2) = 6, ... since these indices are congruent to 2 (mod 3).
		

Crossrefs

Cf. A001281, A124123, A138751, A138752, A138753, A008588 (trisection), A016933 (trisection), A032766 (trisection)

Programs

  • Mathematica
    Table[If[Mod[n,3]==2,Ceiling[n/2],2n],{n,0,70}] (* or *) LinearRecurrence[{0,0,1,0,0,1,0,0,-1},{0,2,1,6,8,3,12,14,4},70] (* Harvey P. Dale, Nov 20 2013 *)
  • PARI
    A138750(n) = if( n%3==2, ceil(n/2), 2*n )

Formula

G.f.: x*(2 + x + 6*x^2 + 6*x^3 + 2*x^4 + 6*x^5 + 4*x^6) / ( (1+x)*(x^2-x+1)*(x-1)^2*(1+x+x^2)^2 ). - R. J. Mathar, Oct 16 2013
a(n) = a(n-3) + a(n-6) - a(n-9); a(0)=0, a(1)=2, a(2)=1, a(3)=6, a(4)=8, a(5)=3, a(6)=12, a(7)=14, a(8)=4. - Harvey P. Dale, Nov 20 2013
Sum_{n>=1} (-1)^n/a(n) = log(3)/2 - log(2)/3 = log(27/4)/6. - Amiram Eldar, Jul 26 2024

A138753 Number of iterations of A138754 before reaching a number for the second time, when starting with n.

Original entry on oeis.org

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

Views

Author

M. F. Hasler, Apr 01 2008

Keywords

Comments

This is a variation of A138752, giving the number of iterations of A138754 needed to get any number for the second time, while A138752 stops counting somehow arbitrarily at 1=primepi(2) or 4=primepi(7).
The map A138754 is a variation of the Collatz map where parity of the integers is replaced by p mod 3 for the primes.
For the Collatz map, we have the only fixed point 0=f(0) and all other numbers seem to end up in the cycle 1->4->2->1.
Here the only fixed point is 1=A138754(1) and all other numbers seem to end up in the cycle 4 -> 7 -> 5 -> 4 (corresponding to primes 7 -> 17 -> 11 -> 7).
Depending on which number among primepi({2,7,11,17}) is reached first, A138753(n) = A138752(n)+1,+3,+2 resp. +1. (A138752(n) is the length of the so-called GB-sequence starting with prime(n).)

Examples

			a(1)=1 since after 1 step we find 1 again.
a(4)=3 since 4 -> 7 -> 5 -> 4 under A138754.
		

Crossrefs

Cf. A124123, A006577, A171938, A138756 (record values/indices).

Programs

Formula

a(n) = min { k>0 | A138754^k(n) = A138754^m(n) for some m>=0, m
If n is not in {1,4,5,7}, then a(n) = 1+a(A138754(n)).

A138751 a(n) = nextprime( p(n)/2 if p(n)=2 (mod 3), 2p(n) else ) = A007918( A138750( A000040( n ))).

Original entry on oeis.org

2, 7, 3, 17, 7, 29, 11, 41, 13, 17, 67, 79, 23, 89, 29, 29, 31, 127, 137, 37, 149, 163, 43, 47, 197, 53, 211, 59, 223, 59, 257, 67, 71, 281, 79, 307, 317, 331, 89, 89, 97, 367, 97, 389, 101, 401, 431, 449, 127, 461, 127, 127, 487, 127, 131, 137, 137, 547, 557, 149
Offset: 1

Author

M. F. Hasler, Mar 28 2008

Keywords

Comments

Composing the map A138750 with A007918 to the left and restricting it to the primes makes it a mapping from primes into primes which is a natural generalization of the Collatz problem to primes. (Looking at parity would not be interesting for primes, so using "mod 3" is the simplest nontrivial generalization.)
The only even prime p=2 is the only fixed point of this map and all odd primes seem to end up in the loop 7 -> 17 -> 11 -> 7, after a number of steps given in A138752.
The sequence A124123 lists the primes which do not occur in the present sequence.
See A138750 for further information.

Examples

			a(1) = nextprime(2/2) = 2, a(2) = nextprime(2*3) = 7, a(3) = nextprime(5/2) = 7.
		

Crossrefs

Programs

  • Mathematica
    A138751[n_]:=With[{p=Prime[n]},NextPrime[If[Mod[p,3]==2,p/2,2p]]];Array[A138751,100] (* Paolo Xausa, Jul 28 2023 *)
  • PARI
    A138751(n) = { n=prime(n); nextprime( if( n%3==2, ceil(n/2), 2*n ))}

Formula

a(n) = A007918(A138750(A000040(n))).

A138757 a(n) = A007918(A138750(n)), that is, least prime > n/2 if n=2 (mod 3), > 2n otherwise.

Original entry on oeis.org

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

Author

M. F. Hasler, Apr 04 2008

Keywords

Comments

This can be considered as an analog of the Collatz (or 3n+1) map on the set of primes, see A138751 and A138754 for details.
Numbers 0,1,2 go immediately to the unique fixed point 2, all others end up in the cycle 7 -> 17 -> 11 -> 7, after a number of iterations given by A138753(A138757(n))-1 (= A138753(n)-2 if n is prime).

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.
		

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))

Formula

a(n) = A007918(A138750(n)).
For p prime, a(p) = A138751(A000720(p))
Showing 1-5 of 5 results.