login
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.
1
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,2
LINKS
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
CROSSREFS
Cf. A026239.
Sequence in context: A368358 A114602 A110000 * A201945 A375319 A362974
KEYWORD
nonn
AUTHOR
Amarnath Murthy, Aug 19 2002
EXTENSIONS
Extended by Ray Chandler, Apr 09 2014
STATUS
approved