cp's OEIS Frontend

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.

A125643 Squares and cubes (with repetition).

Original entry on oeis.org

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

Views

Author

Zak Seidov, Oct 19 2006

Keywords

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.

Crossrefs

Cf. A002760 (squares and cubes (without repetitions)).

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