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.

A288469 a(n) = n if n is a nonprime, otherwise take the prime index of n and repeat until you get a nonprime which is then a(n).

Original entry on oeis.org

1, 1, 1, 4, 1, 6, 4, 8, 9, 10, 1, 12, 6, 14, 15, 16, 4, 18, 8, 20, 21, 22, 9, 24, 25, 26, 27, 28, 10, 30, 1, 32, 33, 34, 35, 36, 12, 38, 39, 40, 6, 42, 14, 44, 45, 46, 15, 48, 49, 50, 51, 52, 16, 54, 55, 56, 57, 58, 4, 60, 18, 62, 63, 64, 65, 66, 8, 68, 69, 70, 20, 72, 21, 74, 75, 76, 77, 78, 22, 80, 81, 82, 9, 84, 85, 86
Offset: 1

Views

Author

Peter Weiss, Jun 09 2017

Keywords

Comments

a(n) = 1 for n in A007097. - Robert Israel, Jun 09 2017

Examples

			For n = 17:  17 is a prime, so you take the prime index of 17 which is 7. 7 is a prime, so you take the prime index of 7 which is 4. 4 is a nonprime, so a(17) = 4.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) option remember; if isprime(n) then procname(numtheory:-pi(n)) else n fi end proc:
    map(f, [$1..100]); # Robert Israel, Jun 09 2017
  • Mathematica
    Table[If[!PrimeQ@ n, n, NestWhile[PrimePi, n, PrimeQ]], {n, 86}] (* Michael De Vlieger, Jun 09 2017 *)
  • PARI
    a(n)=while(isprime(n), n=primepi(n)); n \\ Charles R Greathouse IV, Jun 09 2017

Formula

From Robert Israel, Jun 09 2017: (Start)
a(n) = n + A010051(n)*(a(A000720(n))-n).
a(A114537(n,k)) = A114537(n,1). (End)