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.

A073922 a(1) = 1, a(n) = smallest composite number greater than n and not occurring earlier if n is prime, or smallest prime number greater than n and not occurring earlier if n is composite.

Original entry on oeis.org

1, 4, 6, 5, 8, 7, 9, 11, 13, 17, 12, 19, 14, 23, 29, 31, 18, 37, 20, 41, 43, 47, 24, 53, 59, 61, 67, 71, 30, 73, 32, 79, 83, 89, 97, 101, 38, 103, 107, 109, 42, 113, 44, 127, 131, 137, 48, 139, 149, 151, 157, 163, 54, 167, 173, 179, 181, 191, 60, 193, 62, 197, 199
Offset: 1

Views

Author

Amarnath Murthy, Aug 19 2002

Keywords

Crossrefs

Cf. A026239.

Programs

  • Maple
    p:= 1: c:= 1: R:= 1:
    for n from 2 to 100 do
      if isprime(n) then
        c:= max(c,n)+1;
        while isprime(c) do c:=c+1 od:
        R:= R,c
      else
        p:= nextprime(max(p,n));
        R:= R,p
      fi
    od:
    R; # Robert Israel, Apr 10 2024

Extensions

Extended by Ray Chandler, Apr 09 2014