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.

A026233 a(n) = j if n is the j-th prime, else a(n) = k if n is the k-th nonprime.

Original entry on oeis.org

1, 1, 2, 2, 3, 3, 4, 4, 5, 6, 5, 7, 6, 8, 9, 10, 7, 11, 8, 12, 13, 14, 9, 15, 16, 17, 18, 19, 10, 20, 11, 21, 22, 23, 24, 25, 12, 26, 27, 28, 13, 29, 14, 30, 31, 32, 15, 33, 34, 35, 36, 37, 16, 38, 39, 40, 41, 42, 17, 43, 18, 44, 45, 46, 47, 48
Offset: 1

Views

Author

Keywords

Comments

Each n occurs at two positions, the distances between them are: 1, 1, 1, 1, 2, 3, 5, 5, 8, 13, 13, 17, 20, 21, 23, 28, 33, 34, 39, 41, 41, ... - Zak Seidov, Mar 06 2011

Crossrefs

Cf. A026238.

Programs

  • Haskell
    a026233 n = a049084 n + a239968 n
    -- Reinhard Zumkeller, Mar 30 2014, Feb 12 2014
    
  • Mathematica
    m=100;pr=Prime[Range[m]];npr=Select[Range[m],!PrimeQ[#]&];
    a[n_]:=If[PrimeQ[n],PrimePi[n],Position[npr,n][[1,1]]]; Table[a[n],{n,m}] (* Zak Seidov Mar 05 2011 *) s=Range[500];Do[s=Insert[s,n,Prime[n]],{n,100}];s (* Zak Seidov, Mar 05 2011 *)
  • PARI
    first(n)=my(p,c); vector(n,k,if(isprime(k),p++,c++)) \\ Charles R Greathouse IV, Sep 02 2015

Formula

a(n) = A049084(n) + A066246(n) + A000007(A010051(n)). - Reinhard Zumkeller, Feb 12 2014
a(n) = A049084(n) + A239968(n). - Reinhard Zumkeller, Mar 30 2014