login
A269569
Numbers k such that k+s+c is a square, where s is the nearest square to k and c is the nearest cube to k.
1
0, 2, 4, 8, 29, 37, 45, 56, 68, 80, 92, 99, 115, 235, 257, 279, 413, 593, 751, 791, 831, 909, 955, 1001, 1396, 1450, 1504, 1572, 1961, 2019, 2087, 2500, 2576, 3093, 3634, 3720, 4129, 4223, 4317, 4522, 4624, 4726, 5816, 5928, 6040, 7110, 7232, 7354, 7535, 7665, 8368, 8500
OFFSET
1,2
LINKS
EXAMPLE
The square nearest to 8 is 9, the cube nearest to 8 is 8. Because 8+8+9 is a square, 8 is in the sequence.
The square nearest to 29 is 25, the cube nearest to 29 is 27. Because 29+25+27 is a square, 29 is in the sequence.
MAPLE
filter:= proc(k) local s, ss, sp, c, cc, cp;
s:= isqrt(k); ss:= s^2;
if ss < k then sp:= (s+1)^2; if k - ss > sp - k then ss:= sp fi
elif ss > k then sp:= (s-1)^2; if ss - k > k - sp then ss:= sp fi
fi;
c:= iroot(k, 3); cc:= c^3;
if cc < k then cp:= (c+1)^3; if k - cc > cp - k then cc:= cp fi
elif cc > k then cp:= (c-1)^3; if cc - k > k - cp then cc:= cp fi
fi;
issqr(k+ss+cc)
end proc:
select(filter, [$0..10000]); # Robert Israel, Apr 29 2026
PROG
(Python)
from itertools import count, islice
from math import isqrt
from sympy import integer_nthroot
from sympy.ntheory.primetest import is_square
def A269569_gen(startvalue=0): # generator of terms >= startvalue
return filter(lambda n:is_square(n+(c if (2*n<(c:=(a:=integer_nthroot(n, 3)[0])**3)+(d:=(a+1)**3)) else d)+((m:=isqrt(n))+int(n>m*(m+1)))**2), count(max(startvalue, 0)))
A269569_list = list(islice(A269569_gen(), 50)) # Chai Wah Wu, Apr 30 2026
CROSSREFS
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, Feb 29 2016
STATUS
approved