A125643 Squares and cubes (with repetition).
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
Keywords
Links
- Zak Seidov, Table of n, a(n) for n = 1..1000.
Crossrefs
Programs
-
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 *)
-
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
Extensions
Edited by N. J. A. Sloane at the suggestion of Andrew S. Plewe, Jul 14 2007
Comments