login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A284048
a(n) is the smallest positive integer not already in the sequence such that a(n) + a(n-1) is a proper prime power (A246547), with a(1) = 1.
2
1, 3, 5, 4, 12, 13, 14, 2, 6, 10, 15, 17, 8, 19, 30, 34, 47, 74, 7, 9, 16, 11, 21, 28, 36, 45, 76, 49, 32, 89, 39, 25, 24, 40, 41, 23, 26, 38, 43, 78, 50, 31, 18, 46, 35, 29, 20, 44, 37, 27, 22, 42, 79, 90, 153, 103, 66, 55, 70, 51, 77, 48, 33, 88, 81, 162, 94, 75, 53, 68, 57, 64, 61, 60, 65, 56, 69, 52, 73, 96, 147
OFFSET
1,2
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]
KEYWORD
look,nonn
AUTHOR
Ilya Gutkovskiy, Mar 19 2017
STATUS
approved