OFFSET
1,2
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
Eric Weisstein's World of Mathematics, Prime Power
EXAMPLE
a(5) = 12 because 1, 3, 4 and 5 have already been used in the sequence, 4 + 2 = 6, 4 + 6 = 10, 4 + 7 = 11, 4 + 8 = 12, 4 + 9 = 13, 4 + 10 = 14 and 4 + 11 = 15 are not proper prime powers while 4 + 12 = 16 is a proper prime power.
MAPLE
N:= 2000: # to get all terms before the first where a(n)+a(n-1)>N
PP:= {seq(seq(p^j, j =2..floor(log[p](N))), p = select(isprime, [2, seq(i, i=3..floor(sqrt(N)), 2)]))}:
PP:= sort(convert(PP, list)):
V:= Vector(N, datatype=integer[1], 1):
A[1]:= 1; V[1]:= 0;
for n from 2 do
for pp in PP do
t:= pp - A[n-1];
if t > 0 and V[t] = 1 then
A[n]:= t; V[t]:= 0; break
fi;
od;
if not assigned(A[n]) then break fi
od:
seq(A[i], i=1..n-1); # Robert Israel, Apr 24 2017
MATHEMATICA
f[s_List] := Block[{k = 1, a = s[[-1]]}, While[MemberQ[s, k] || ! (PrimePowerQ[a + k] && PrimeOmega[a + k] > 1), k++]; Append[s, k]]; Nest[f, {1}, 80]
CROSSREFS
KEYWORD
look,nonn
AUTHOR
Ilya Gutkovskiy, Mar 19 2017
STATUS
approved