OFFSET
1,1
COMMENTS
n^2 + a(n)^2 belongs to A007692.
The identity n^2 + (2*n + 5)^2 = (n+4)^2 + (2*n + 3)^2 shows that a(n) <= 2*n + 5. The last case when the equality holds is n = 16.
a(n) = a(n+1) has infinitely many solutions. This holds, in particular, when n = (u*v + u + v - 1) * (u*v - 2)/2 - 1 for positive integers u, v satisfying v+2 <= u <= 6*v - 3.
a(n-1) = a(n) = a(n+1) holds for n = (3*v^2 + 5*v + 1) * (6*v^2 + 3*v - 2), v >= 3.
LINKS
EXAMPLE
a(10) = 25, since 10^2 + 25^2 = 14^2 + 23^2, and no integers b, c, d exist satisfying 10 < c <= d < b < 25 and 10^2 + b^2 = c^2 + d^2.
MAPLE
a :=proc(n::integer) local found::boolean; local N, SQ, i;
found:=false; N:=n+1; SQ:={};
while not found do SQ:=SQ union {N^2}; N:=N+1;
for i from n+1 to N-1 do
if evalb(N^2+n^2-i^2 in SQ) then found:=true; end if;
end do; end do; N end proc;
CROSSREFS
KEYWORD
nonn
AUTHOR
Giedrius Alkauskas, Feb 21 2023
STATUS
approved