PentagonalNumbers
The pentagonal numbers — — dots in a pentagon.
PentagonalNumbers for .Details
- A lazy indexed collection: , and unranks in closed form -- .
- OEIS A000326.
- Membership goes through Element by inverting the closed form exactly, solving the quadratic in over the integers -- is true, is false.
- The -gonal case of PolygonalNumbers; not to be confused with the (signed-index) generalized pentagonal numbers of Euler's pentagonal number theorem.
Definition
Epsil, as the implementation runs it.
count()
PositiveInfinityunrank(_r)
(_r + 1) * (3 * (_r + 1) - 1) / 2rank(_x)
Apply(
(sq_at: integer) => sq_at if (sq_at + 1) * (3 * (sq_at + 1) - 1) / 2 ==
_x else -1,
Fold(Function(
sq_at + 2 ^ sq_b if (sq_at + 2 ^ sq_b + 1) * (3 * (sq_at +
2 ^
sq_b + 1) -
1) / 2 <= _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) => (sq_at + 1) * (3 * (sq_at + 1) - 1) / 2 == _x,
Fold(Function(
sq_at + 2 ^ sq_b if (sq_at + 2 ^ sq_b + 1) * (3 * (sq_at +
2 ^
sq_b + 1) -
1) / 2 <= _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 | OEISWolfram LanguageSageMath |
See also: PolygonalNumbers, TriangularNumbers, HexagonalNumbers, Count, At, Element