OFFSET
1,2
COMMENTS
For n > 2, a(n) - a(n-1) <= 4.
LINKS
Peter Kagey, Table of n, a(n) for n = 1..10000
EXAMPLE
The first composite number is 4, but 1 + 4 = 5, which is prime, and also 1 + 6 = 7 also prime. Since 1 + 8 = 9 = 3^2, a(2) = 8.
After 8, 9 is also composite but 8 + 9 = 17, which is prime. But 10 works: 8 + 10 = 18 = 2 * 3^2, hence a(3) = 10.
MAPLE
m:= 0:
for n from 1 to 100 do
for k from m+1 while isprime(k) or isprime(m+k) do od:
a[n]:= k;
m:= k;
od:
seq(a[i], i=1..100); # Robert Israel, Sep 20 2015
MATHEMATICA
a = {1}; Do[k = a[[n - 1]] + 1; While[Nand[CompositeQ@ k, CompositeQ[a[[n - 1]] + k]], k++]; AppendTo[a, k], {n, 2, 72}]; a (* Michael De Vlieger, Sep 17 2015 *)
PROG
(PARI) lista(nn) = {print1(a = 1, ", "); for(n=1, nn, forcomposite(k=a+1, , if (!isprime(a+k), print1(k, ", "); a = k; break); ); ); } \\ Michel Marcus, Sep 20 2015
CROSSREFS
KEYWORD
nonn
AUTHOR
Gionata Neri, Sep 13 2015
EXTENSIONS
a(51)-a(70) from Michael De Vlieger, Sep 17 2015
STATUS
approved