login
a(1)=1; thereafter a(n) = smallest square m^2 such that m^2 minus (sum of all previous terms) is prime.
2

%I #14 Nov 14 2016 17:36:49

%S 1,4,16,64,144,576,1296,3600,6084,15876,28224,82944,147456,298116,

%T 627264,1218816,2433600,4928400,9809424,19607184,39237696,78535044,

%U 158155776,316057284,633830976,1265509476,2532303684,5062891716,10128007044,20260106244,40519274436,81043841124

%N a(1)=1; thereafter a(n) = smallest square m^2 such that m^2 minus (sum of all previous terms) is prime.

%H Robert Israel, <a href="/A249567/b249567.txt">Table of n, a(n) for n = 1..3310</a>

%e 16 - (1+4) = 11 (prime), 64 - (1+4+16) = 43 (prime).

%p A[1]:= 1: S:= 1:

%p for n from 2 to 100 do

%p m0:= ceil(sqrt(2+S));

%p if m0::odd then m0:= m0+1 fi;

%p for m from m0 by 2 do

%p if isprime(m^2 - S) then

%p A[n]:= m^2;

%p S:= S + A[n];

%p break

%p fi

%p od

%p od:

%p seq(A[i],i=1..100); # _Robert Israel_, Nov 14 2016

%t A249567 = {1}; n = 2; While[n < 10^5, If[n^2 - Total[A249567] > 0 && PrimeQ[n^2 - Total[A249567]], AppendTo[A249567, n^2]]; n++]; A249567 (* _Ivan N. Ianakiev_, Nov 03 2014 *)

%K nonn

%O 1,2

%A _Zak Seidov_, Nov 01 2014