[go: up one dir, main page]

login
A351855
Partial sums of nonsquares that are partial sums of nonprimes.
1
5, 64, 506, 64325, 268723, 480129, 6282620, 64548862, 9657523883, 13480852825, 29766135708, 105223301080, 519861666225, 851245744041, 1378216791896, 581522966976875, 583298551668358, 885441628670251, 1651966084813205, 16868988672306046, 17170433482837259
OFFSET
1,1
LINKS
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
A351855_list = list(islice(A351855_gen(), 20)) # Chai Wah Wu, Apr 04 2022
CROSSREFS
Intersection of A051349 and A086849.
Sequence in context: A193184 A180787 A222455 * A178295 A054937 A302993
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