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.

A129131 Alternately write composite and prime numbers.

Original entry on oeis.org

4, 2, 6, 3, 8, 5, 9, 7, 10, 11, 12, 13, 14, 17, 15, 19, 16, 23, 18, 29, 20, 31, 21, 37, 22, 41, 24, 43, 25, 47, 26, 53, 27, 59, 28, 61, 30, 67, 32, 71, 33, 73, 34, 79, 35, 83, 36, 89, 38, 97, 39, 101, 40, 103, 42, 107, 44, 109, 45, 113, 46, 127, 48, 131, 49, 137, 50, 139, 51
Offset: 1

Views

Author

Edwin F. Sampang, Mar 30 2007

Keywords

Comments

a(2n-1) = A073846(2n+1), a(2n) = A073846(2n).

Examples

			Lowest composite number is 4, lowest prime number is 2, next composite number after 4 is 6, next prime number after 2 is 3 and so on.
		

Crossrefs

Cf. A000040 (prime numbers), A002808 (composite numbers), A073846 (alternate nonprime and prime numbers).

Programs

  • Magma
    P:=[ n : n in [2..150] | IsPrime(n) ]; C:=[ n : n in [2..70] | not IsPrime(n) ]; &cat[ [C[k], P[k] ]: k in [1..Minimum(#C, #P)] ]; // Klaus Brockhaus, Mar 31 2007
  • Mathematica
    f[n_]:=Module[{prs=Prime[Range[n]],comps},comps=Rest[Complement[Range[n+ Length[prs]+1], prs]];Riffle[comps,prs]] (* Harvey P. Dale, May 10 2011 *)

Formula

a(n) = A066249(n) + 1. - Filip Zaludek, Dec 10 2016

Extensions

Edited and extended by Klaus Brockhaus, Mar 31 2007