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”).
%I #31 Apr 05 2022 17:06:35
%S 5,64,506,64325,268723,480129,6282620,64548862,9657523883,13480852825,
%T 29766135708,105223301080,519861666225,851245744041,1378216791896,
%U 581522966976875,583298551668358,885441628670251,1651966084813205,16868988672306046,17170433482837259
%N Partial sums of nonsquares that are partial sums of nonprimes.
%H Chai Wah Wu, <a href="/A351855/b351855.txt">Table of n, a(n) for n = 1..26</a>
%e a(2) = 64 is a term because 64 = 1+4+6+8+9+10+12+14 = 2+3+5+6+7+8+10+11+12 is the sum of the first 8 nonprimes and the sum of the first 9 nonsquares.
%p i:= 0: j:= 0: s:= 0: t:= 0:
%p R:= NULL: count:= 0:
%p while count < 13 do
%p if s <= t then
%p i:= i+1;
%p if not issqr(i) then
%p s:= s+i;
%p if s=t then R:= R,s; count:= count+1 fi;
%p fi
%p else
%p j:= j+1;
%p if not isprime(j) then
%p t:= t+j;
%p if s=t then R:= R,t; count:= count+1 fi;
%p fi
%p fi
%p od:
%p R;
%o (Python)
%o from itertools import islice
%o from sympy import nextprime
%o def A351855_gen(): # generator of terms
%o c, k, ks, m, p, q = 0, 1, 2, 1, 4, 5
%o while True:
%o for n in range(ks,ks+2*k):
%o c += n
%o if c == m:
%o yield c
%o else:
%o while c > m:
%o m += p
%o p += 1
%o if p == q:
%o q = nextprime(q)
%o p += 1
%o ks += 2*k+1
%o k += 1
%o A351855_list = list(islice(A351855_gen(),20)) # _Chai Wah Wu_, Apr 04 2022
%Y Intersection of A051349 and A086849.
%K nonn
%O 1,1
%A _J. M. Bergot_ and _Robert Israel_, Mar 31 2022
%E a(20)-a(21) from _Jon E. Schoenfield_, Mar 31 2022