login
A125643
Squares and cubes (with repetition).
2
0, 0, 1, 1, 4, 8, 9, 16, 25, 27, 36, 49, 64, 64, 81, 100, 121, 125, 144, 169, 196, 216, 225, 256, 289, 324, 343, 361, 400, 441, 484, 512, 529, 576, 625, 676, 729, 729, 784, 841, 900, 961, 1000, 1024, 1089, 1156, 1225, 1296, 1331, 1369, 1444, 1521, 1600, 1681
OFFSET
1,5
COMMENTS
Repeating terms are sixth powers: 0,1,64,729,... (A001014).
For numbers not appearing as a difference between a square and an adjacent cube in this list, see A054504 and A081121.
MATHEMATICA
m=1681; cm=Floor[m^(1/3)]; sm=Floor[Sqrt[m]]; s=Range[0, sm]^2; c=Range[0, cm]^3; Sort[Join[s, c]] (* James C. McMahon, Dec 20 2024 *)
PROG
(Python)
from math import isqrt
from sympy import integer_nthroot
def A125643(n):
if n <= 4: return n-1>>1
def bisection(f, kmin=0, kmax=1):
while f(kmax) > kmax: kmax <<= 1
while kmax-kmin > 1:
kmid = kmax+kmin>>1
if f(kmid) <= kmid:
kmax = kmid
else:
kmin = kmid
return kmax
def f(x): return n-2+x-integer_nthroot(x, 3)[0]-isqrt(x)
return bisection(f, n-2, n-2) # Chai Wah Wu, Oct 14 2024
CROSSREFS
Cf. A002760 (squares and cubes (without repetitions)).
Sequence in context: A025475 A246547 A195942 * A002760 A377025 A355062
KEYWORD
nonn
AUTHOR
Zak Seidov, Oct 19 2006
EXTENSIONS
Edited by N. J. A. Sloane at the suggestion of Andrew S. Plewe, Jul 14 2007
STATUS
approved