login
a(1) = 1, then smallest square not included earlier such that every partial sum is a prime.
3

%I #10 Apr 09 2023 02:06:00

%S 1,4,36,576,144,2916,324,1296,900,2304,3600,7056,1764,8100,4356,5184,

%T 9216,6084,14400,15876,10404,22500,20736,11664,24336,12996,19044,

%U 17424,32400,41616,44100,28224,34596,36864,54756,30276,26244,46656,39204

%N a(1) = 1, then smallest square not included earlier such that every partial sum is a prime.

%H Robert Israel, <a href="/A073852/b073852.txt">Table of n, a(n) for n = 1..10000</a>

%p R:= 1: cands:= [seq(i^2,i=2..10^6)]: nc:= 10^6-1: s:= 1: found:= true:

%p for n from 2 to 100 while found do

%p found:= false;

%p for j from 1 to nc do

%p if isprime(s+cands[j]) then

%p found:= true; R:= R, cands[j];

%p s:= s+cands[j];

%p cands:= subsop(j=NULL,cands);

%p break

%p fi

%p od od:

%p R; # _Robert Israel_, Apr 09 2023

%o (PARI) v=[1]; n=1; while(n<10^3, if(isprime(n^2+vecsum(v))&&!vecsearch(vecsort(v), n^2), v=concat(v, n^2); n=1); n++); v \\ _Derek Orr_, Jun 06 2015

%Y Cf. A073854.

%K nonn,easy

%O 1,2

%A _Amarnath Murthy_, Aug 15 2002

%E Corrected and extended by Antonio G. Astudillo (afg_astudillo(AT)lycos.com), Apr 24 2003