Skip to content

HeptagonalNumbers ​

The heptagonal numbers 1,7,18,34,…1, 7, 18, 34, … — n(5n−3)/2n(5n-3)/2 — dots in a heptagon.

HeptagonalNumbersn(5n−3)/2n(5n-3)/2 for n=1,2,3,…n = 1, 2, 3, ….

Domain: Collections

Details
  • A lazy indexed collection: Count(HeptagonalNumbers)=+∞Count(HeptagonalNumbers) = +\infty, and At(HeptagonalNumbers,k)=k(5k−3)/2At(HeptagonalNumbers, k) = k(5k-3)/2 unranks in closed form -- At(HeptagonalNumbers,5)=55At(HeptagonalNumbers, 5) = 55.
  • OEIS A000566.
  • Membership goes through Element by inverting the closed form exactly -- Element(55,HeptagonalNumbers)Element(55, HeptagonalNumbers) is true, Element(54,HeptagonalNumbers)Element(54, HeptagonalNumbers) is false.
  • The kk-gonal case k=7k=7 of PolygonalNumbers.

Definition

Epsil, as the implementation runs it.

count()

PositiveInfinity

unrank(_r)

(_r + 1) * (5 * (_r + 1) - 3) / 2

rank(_x)

Apply(
       (sq_at: integer) => sq_at if (sq_at + 1) * (5 * (sq_at + 1) - 3) / 2 ==
                                    _x else -1,
       Fold(Function(
                      sq_at + 2 ^ sq_b if (sq_at + 2 ^ sq_b + 1) * (5 * (sq_at +
                                                                         2 ^
                                                                         sq_b + 1) -
                                                                    3) / 2 <= _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) * (5 * (sq_at + 1) - 3) / 2 == _x,
       Fold(Function(
                      sq_at + 2 ^ sq_b if (sq_at + 2 ^ sq_b + 1) * (5 * (sq_at +
                                                                         2 ^
                                                                         sq_b + 1) -
                                                                    3) / 2 <= _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
CrosswalkOEISWolfram LanguageSageMath

See also: PolygonalNumbers, HexagonalNumbers, OctagonalNumbers, Count, At, Element