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.

This page as a plain text file.
%I A073922 #12 Apr 10 2024 15:07:17
%S A073922 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,
%T A073922 61,67,71,30,73,32,79,83,89,97,101,38,103,107,109,42,113,44,127,131,
%U A073922 137,48,139,149,151,157,163,54,167,173,179,181,191,60,193,62,197,199
%N 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.
%H A073922 Robert Israel, <a href="/A073922/b073922.txt">Table of n, a(n) for n = 1..10000</a>
%p A073922 p:= 1: c:= 1: R:= 1:
%p A073922 for n from 2 to 100 do
%p A073922   if isprime(n) then
%p A073922     c:= max(c,n)+1;
%p A073922     while isprime(c) do c:=c+1 od:
%p A073922     R:= R,c
%p A073922   else
%p A073922     p:= nextprime(max(p,n));
%p A073922     R:= R,p
%p A073922   fi
%p A073922 od:
%p A073922 R; # _Robert Israel_, Apr 10 2024
%Y A073922 Cf. A026239.
%K A073922 nonn
%O A073922 1,2
%A A073922 _Amarnath Murthy_, Aug 19 2002
%E A073922 Extended by _Ray Chandler_, Apr 09 2014