Skip to content

CubeNumbers ​

The perfect cubes 1,8,27,64,…1, 8, 27, 64, … — n3n^3.

CubeNumbersn3n^3 for n=1,2,3,…n = 1, 2, 3, ….

Domain: Collections

Details
  • A lazy indexed collection: Count(CubeNumbers)=+∞Count(CubeNumbers) = +\infty, and At(CubeNumbers,k)=k3At(CubeNumbers, k) = k^3 unranks in closed form -- At(CubeNumbers,5)=125At(CubeNumbers, 5) = 125.
  • OEIS A000578.
  • Membership goes through Element by bisecting the monotone formula n↦n3n \mapsto n^3 for its exact integer cube root -- Element(125,CubeNumbers)Element(125, CubeNumbers) is true, Element(126,CubeNumbers)Element(126, CubeNumbers) is false.

Definition

Epsil, as the implementation runs it.

count()

PositiveInfinity

unrank(_r)

(_r + 1) ^ 3

rank(_x)

Apply(
       (sq_at: integer) => sq_at if (sq_at + 1) ^ 3 == _x else -1,
       Fold(Function(
                      sq_at + 2 ^ sq_b if (sq_at + 2 ^ sq_b + 1) ^ 3 <= _x else sq_at,
                      sq_at,
                      sq_b,
                    ), 0, Range(Floor(Log(_x, 2)) + 1, 0, -1)),
     ) if True else -1

valid(_x)

Apply(
       (sq_at: integer) => (sq_at + 1) ^ 3 == _x,
       Fold(Function(
                      sq_at + 2 ^ sq_b if (sq_at + 2 ^ sq_b + 1) ^ 3 <= _x else sq_at,
                      sq_at,
                      sq_b,
                    ), 0, Range(Floor(Log(_x, 2)) + 1, 0, -1)),
     ) if True && _x >= 1 else False

Enumeration

Examples

1 more kept as data, checked against the oracles
About
Examples1
CrosswalkOEIS

See also: SquareNumbers, TetrahedralNumbers, Count, At, Element