OFFSET
1,2
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
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)))
CROSSREFS
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, Feb 29 2016
STATUS
approved
