TetrahedralNumbers
The tetrahedral numbers — — stacked triangles, partial sums of the triangular numbers.
OEIS
A000292TetrahedralNumbers for .Details
- A lazy indexed collection: , and unranks in closed form -- .
- OEIS A000292.
- Membership goes through Element by bisecting the monotone cubic for its exact root -- is true, is false.
- ; the 4-simplex case is PentatopeNumbers.
Definition
Epsil, as the implementation runs it.
count()
PositiveInfinityunrank(_r)
Binomial(_r + 3, 3)rank(_x)
Apply(
(sq_at: integer) => sq_at if Binomial(sq_at + 3, 3) == _x else -1,
Fold(Function(
sq_at + 2 ^ sq_b if Binomial(sq_at + 2 ^ sq_b + 3, 3) <=
_x else sq_at,
sq_at,
sq_b,
), 0, Range(Floor(Log(_x, 2)) + 1, 0, -1)),
) if True else -1valid(_x)
Apply(
(sq_at: integer) => Binomial(sq_at + 3, 3) == _x,
Fold(Function(
sq_at + 2 ^ sq_b if Binomial(sq_at + 2 ^ sq_b + 3, 3) <=
_x else sq_at,
sq_at,
sq_b,
), 0, Range(Floor(Log(_x, 2)) + 1, 0, -1)),
) if True && _x >= 1 else FalseEnumeration
Examples
1 more kept as data, checked against the oraclesAbout
| Examples | 1 |
|---|---|
| Crosswalk | OEIS |
See also: TriangularNumbers, PentatopeNumbers, Binomial, Count, At, Element