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.

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

Views

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.
		

Crossrefs

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