OFFSET
1,2
COMMENTS
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
Michael De Vlieger, Log log scatterplot of a(n), n = 1..10^4, showing primes in red and nonprimes in blue.
EXAMPLE
For n = 2, (prime), a(2) = 9, the smallest composite number not divisible by 2.
For n = 6, (composite), a(6) = 5, the smallest novel prime which does not divide 6.
MATHEMATICA
nn = 120; c[_] := False; a[1] = 1; c[1] = True; u = 2; v = 4;
Do[If[PrimeQ[n],
k = v; While[Or[c[k], PrimeQ[k], Divisible[k, n]], k++],
k = u; While[Or[c[k], CompositeQ[k], Divisible[n, k]], k++]];
Set[{a[n], c[k]}, {k, True}];
If[k == u, While[Or[c[u], CompositeQ[u]], u++]];
If[k == v, While[Or[c[v], PrimeQ[v]], v++]], {n, 2, nn}];
Array[a, nn] (* Michael De Vlieger, May 31 2024 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
David James Sycamore, May 30 2024
EXTENSIONS
More terms from Michael De Vlieger, May 31 2024
STATUS
approved