OFFSET
1,1
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..26
EXAMPLE
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.
MAPLE
i:= 0: j:= 0: s:= 0: t:= 0:
R:= NULL: count:= 0:
while count < 13 do
if s <= t then
i:= i+1;
if not issqr(i) then
s:= s+i;
if s=t then R:= R, s; count:= count+1 fi;
fi
else
j:= j+1;
if not isprime(j) then
t:= t+j;
if s=t then R:= R, t; count:= count+1 fi;
fi
fi
od:
R;
PROG
(Python)
from itertools import islice
from sympy import nextprime
def A351855_gen(): # generator of terms
c, k, ks, m, p, q = 0, 1, 2, 1, 4, 5
while True:
for n in range(ks, ks+2*k):
c += n
if c == m:
yield c
else:
while c > m:
m += p
p += 1
if p == q:
q = nextprime(q)
p += 1
ks += 2*k+1
k += 1
CROSSREFS
KEYWORD
nonn
AUTHOR
J. M. Bergot and Robert Israel, Mar 31 2022
EXTENSIONS
a(20)-a(21) from Jon E. Schoenfield, Mar 31 2022
STATUS
approved