OFFSET
1,2
COMMENTS
Conjecture: a(n) = {1,3} UNION {permutation of even positive numbers}.
The corresponding partial sums + 1 are 2, 5, 7, 13, 17, 29, 37, 47, 61, 79, 101, 127, 151, ...,.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = MIN{k>0 such that 1 + k + SUM[i=1..n-1]a(i) is prime and k <> a(i)}.
EXAMPLE
a(1) = 1 because 1+1 = 2 is prime.
a(2) = 3 because 1+3+1 = 5 is prime.
a(3) = 2 because 1+3+2+1 = 7 is prime.
a(4) = 4 because 1+3+2+4+1 = 11 is prime.
MAPLE
N:= 200: # to get all terms before the first term > N
A[1]:= 1: A[2]:= 3: P:= 5; S:= [seq(2*i, i=1..N/2)]:
for n from 3 while assigned(A[n-1]) do
for k from 1 to nops(S) do
if isprime(P+S[k]) then
A[n]:= S[k];
P:= P + S[k];
S:= subsop(k=NULL, S);
break
fi
od;
od:
seq(A[i], i=1..n-2); # Robert Israel, May 02 2017
MATHEMATICA
f[s_] := Append[s, k = 1; p = 1 + Plus @@ s; While[MemberQ[s, k] || ! PrimeQ[p + k], k++ ]; k]; Nest[f, {}, 67] (* Robert G. Wilson v *)
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Jonathan Vos Post, Aug 30 2006
EXTENSIONS
Corrected and extended by Robert G. Wilson v, Aug 31 2006
Comment edited by Robert Israel, May 02 2017
STATUS
approved