This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A125643 #27 Dec 20 2024 10:18:28 %S A125643 0,0,1,1,4,8,9,16,25,27,36,49,64,64,81,100,121,125,144,169,196,216, %T A125643 225,256,289,324,343,361,400,441,484,512,529,576,625,676,729,729,784, %U A125643 841,900,961,1000,1024,1089,1156,1225,1296,1331,1369,1444,1521,1600,1681 %N A125643 Squares and cubes (with repetition). %C A125643 Repeating terms are sixth powers: 0,1,64,729,... (A001014). %C A125643 For numbers not appearing as a difference between a square and an adjacent cube in this list, see A054504 and A081121. %H A125643 Zak Seidov, <a href="/A125643/b125643.txt">Table of n, a(n) for n = 1..1000.</a> %t A125643 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 *) %o A125643 (Python) %o A125643 from math import isqrt %o A125643 from sympy import integer_nthroot %o A125643 def A125643(n): %o A125643 if n <= 4: return n-1>>1 %o A125643 def bisection(f,kmin=0,kmax=1): %o A125643 while f(kmax) > kmax: kmax <<= 1 %o A125643 while kmax-kmin > 1: %o A125643 kmid = kmax+kmin>>1 %o A125643 if f(kmid) <= kmid: %o A125643 kmax = kmid %o A125643 else: %o A125643 kmin = kmid %o A125643 return kmax %o A125643 def f(x): return n-2+x-integer_nthroot(x,3)[0]-isqrt(x) %o A125643 return bisection(f,n-2,n-2) # _Chai Wah Wu_, Oct 14 2024 %Y A125643 Cf. A002760 (squares and cubes (without repetitions)). %Y A125643 Cf. A001014, A054504, A081121, A087285, A087286, A088017. %K A125643 nonn %O A125643 1,5 %A A125643 _Zak Seidov_, Oct 19 2006 %E A125643 Edited by _N. J. A. Sloane_ at the suggestion of _Andrew S. Plewe_, Jul 14 2007