login
A388659
Numbers k for which there exists m such that the sum from 1 to m and the sum from m + 1 to k are both perfect squares.
1
4, 9, 16, 25, 40, 89, 144, 148, 233, 289, 520, 800, 841, 865, 936, 1360, 3033, 4513, 4900, 4904, 5044, 5329, 7929, 9801, 10953, 11024, 13000, 14841, 17680, 18793, 19024, 26280, 28561, 28585, 29008, 29401, 29800, 31040, 46216, 46696, 47353, 57460, 62164
OFFSET
1,1
COMMENTS
Given the set {1, 2, 3,..., k}, we want to separate it into the disjoint sets {1, 2, 3,..., m} and {m + 1, m + 2,..., k}, so that the sum of the elements of each set is a square.
We want the sum from 1 to m to be a square, that is, m*(m + 1)/2 to be a square. Therefore, m is in A001108. Furthermore, (m + 1) + (m + 2) + ... + k = u^2, where u is an integer. Then, k*(k + 1)/2 - m*(m + 1)/2 = u^2, which can be rewritten as (2*k + 1)^2 - 8*u^2 = (2*m + 1)^2, which is a generalized Pell equation.
LINKS
David Consiglio, Jr., Table of n, a(n) for n = 1..100
David Consiglio, Jr., Python
EXAMPLE
k = 16 is in this sequence since for m = 8, 1 + 2 + 3 +...+ 8 = 6^2 and also 9 + 10 + 11 +...+ 16 = 10^2.
MAPLE
N:= 10^5: # for terms <= N
mf:= proc(i) option remember; 6*procname(i-1) - procname(i-2) + 2 end proc: mf(0):= 0: mf(1):= 1:
R:= {}:
for i from 1 do
m:= mf(i);
if m >= N then break fi;
eq:= K^2 = 8*z^2 + (2*m+1)^2;
S:= [isolve(eq)];
for s in S do
if subs(expand(eval(s, _Z1=1)), [K, z])::list(posint) then
for zi from 0 do
v:= (expand(subs(_Z1=zi, subs(s, K)))-1)/2;
if v > N then break fi;
if v > m then R:= R union {v} fi;
od fi od od:
sort(convert(R, list)); # Robert Israel, Jan 08 2026
CROSSREFS
KEYWORD
nonn
AUTHOR
Gonzalo Martínez, Dec 16 2025
STATUS
approved