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.

Showing 1-1 of 1 results.

A163578 If n is prime, a(n) is next composite greater than a(n-1), else if n is composite, a(n) is next prime greater than a(n-1) else 2.

Original entry on oeis.org

2, 4, 6, 7, 8, 11, 12, 13, 17, 19, 20, 23, 24, 29, 31, 37, 38, 41, 42, 43, 47, 53, 54, 59, 61, 67, 71, 73, 74, 79, 80, 83, 89, 97, 101, 103, 104, 107, 109, 113, 114, 127, 128, 131, 137, 139, 140, 149, 151, 157, 163, 167, 168, 173, 179, 181, 191, 193, 194, 197, 198, 199
Offset: 1

Views

Author

Gerald Hillier, Jul 31 2009

Keywords

Examples

			1 is not prime, a(1)=2.
2 is prime, a(2)=4.
3 is prime, a(3)=6.
4 is composite, a(4)=7.
		

Crossrefs

Programs

  • Mathematica
    Join[{2, 4}, FoldList[If[PrimeQ[#2], #+1, NextPrime[#]] &, 6, Range[4, 100]]] (* Paolo Xausa, Sep 03 2025 *)

Extensions

More terms from Paolo Xausa, Sep 03 2025
Showing 1-1 of 1 results.