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.

A073898 a(1) = 1; for n>1, a(n) = smallest even or odd number not occurring earlier accordingly as n is prime or composite.

Original entry on oeis.org

1, 2, 4, 3, 6, 5, 8, 7, 9, 11, 10, 13, 12, 15, 17, 19, 14, 21, 16, 23, 25, 27, 18, 29, 31, 33, 35, 37, 20, 39, 22, 41, 43, 45, 47, 49, 24, 51, 53, 55, 26, 57, 28, 59, 61, 63, 30, 65, 67, 69, 71, 73, 32, 75, 77, 79, 81, 83, 34, 85, 36, 87, 89, 91, 93, 95, 38, 97, 99, 101, 40, 103
Offset: 1

Views

Author

Amarnath Murthy, Aug 18 2002

Keywords

Comments

Inverse of A073846. - Chayim Lowen, Oct 28 2015

Crossrefs

Programs

  • Maple
    A073898 :=proc(nmax) local a,n,k; a := [1] ; while nops(a) < nmax do n := nops(a)+1 ; if isprime(n) then k :=2; else k :=1; fi ; while k in a do k := k+2 ; od ; a := [op(a),k] ; od ; RETURN(a) ; end: op(A073898(80)) ; # R. J. Mathar, Jun 27 2007
  • Mathematica
    Table[(4 PrimePi[n] - 2 n - 1)*(PrimePi[n] - PrimePi[n - 1]) + 2 (n - PrimePi[n - 1]) - 1, {n, 72}] (* Michael De Vlieger, Nov 11 2015 *)
  • PARI
    vector(100, n, (4*primepi(n)-2*n-1)*(primepi(n)-primepi(n-1))+2*(n-primepi(n-1))-1) \\ Altug Alkan, Oct 29 2015

Formula

a(n) = (4*pi(n)-2*n-1)*(pi(n)-pi(n-1)) + 2*(n - pi(n-1)) - 1, where pi = A000720. - Robert Israel, Oct 28 2015

Extensions

Corrected and extended by R. J. Mathar, Jun 27 2007