Skip to content

PowerfulNumbers ​

The powerful numbers 1,4,8,9,16,…1, 4, 8, 9, 16, … -- integers where every prime factor appears squared or more -- as a lazy indexed collection.

PowerfulNumbersthe nn whose every prime factor has exponent ≥2\ge 2, an infinite indexed collection.

Domain: Collections

Details
  • A lazy indexed collection: Count(PowerfulNumbers)=+∞Count(PowerfulNumbers) = +\infty (every perfect square is powerful), and AtAt unranks the kk-th by scanning forward, testing each candidate's factorisation.
  • OEIS A001694. Every powerful number factors uniquely as a2b3a^2 b^3 for squarefree bb.
  • Membership goes through Element: Element(8,PowerfulNumbers)Element(8, PowerfulNumbers) is true (8=238 = 2^3), Element(12,PowerfulNumbers)Element(12, PowerfulNumbers) is false (12=22⋅312 = 2^2 \cdot 3, and 33's exponent is only 11).

Definition

Epsil, as the implementation runs it.

count()

PositiveInfinity

unrank(_r)

Apply(
       (sn_f: integer) => sn_f if sn_f > 0 else `NaN`,
       Fold(Function(
                      sn_s if sn_s > 0 else (sn_k if sn_s + _r == 0 else sn_s -
                                                                         1) if Fold(
                                                                                    Function(pw_f ||
                                                                                             pw_b ^ 3 <=
                                                                                             sn_k &&
                                                                                             sn_k %
                                                                                             pw_b ^ 3 ==
                                                                                             0 &&
                                                                                             Round(Sqrt(sn_k /
                                                                                                        pw_b ^ 3)) *
                                                                                             Round(Sqrt(sn_k /
                                                                                                        pw_b ^ 3)) ==
                                                                                             sn_k /
                                                                                             pw_b ^ 3, pw_f, pw_b),
                                                                                    False,
                                                                                    Range(1, Floor(sn_k ^
                                                                                                   (1 / 3)) +
                                                                                             2, 1),
                                                                                  ) else sn_s,
                      sn_s,
                      sn_k,
                    ), 0, Range(1, (_r + 1) ^ 2, 1)),
     )

rank(_x)

Fold(Function(sn_c + 1 if Fold(
                                Function(pw_f || pw_b ^ 3 <= sn_k && sn_k % pw_b ^
                                                                            3 ==
                                                                     0 && Round(Sqrt(sn_k /
                                                                                    pw_b ^ 3)) *
                                                                         Round(Sqrt(sn_k /
                                                                                    pw_b ^ 3)) == sn_k /
                                                                             pw_b ^
                                                                             3, pw_f, pw_b),
                                False,
                                Range(1, Floor(sn_k ^ (1 / 3)) + 2, 1),
                              ) else sn_c, sn_c, sn_k), 0, Range(1, _x - 1, 1)) if (Fold(
                                                                                         Function(pw_f ||
                                                                                                  pw_b ^ 3 <=
                                                                                                  _x &&
                                                                                                  _x %
                                                                                                  pw_b ^ 3 ==
                                                                                                  0 &&
                                                                                                  Round(Sqrt(_x /
                                                                                                             pw_b ^ 3)) *
                                                                                                  Round(Sqrt(_x /
                                                                                                             pw_b ^ 3)) ==
                                                                                                  _x /
                                                                                                  pw_b ^ 3, pw_f, pw_b),
                                                                                         False,
                                                                                         Range(1, Floor(_x ^
                                                                                                        (1 / 3)) +
                                                                                                  2, 1),
                                                                                       ) if _x >= 1 else False) else -1

valid(_x)

Fold(
      Function(
                pw_f || pw_b ^ 3 <= _x && _x % pw_b ^ 3 == 0 && Round(Sqrt(_x /
                                                                           pw_b ^
                                                                           3)) *
                                                                Round(Sqrt(_x /
                                                                           pw_b ^
                                                                           3)) == _x / pw_b ^
                                                                         3,
                pw_f,
                pw_b,
              ),
      False,
      Range(1, Floor(_x ^ (1 / 3)) + 2, 1),
    ) if _x >= 1 else False

Enumeration

Examples

1 more kept as data, checked against the oracles
Properties #
live ↗
In36∈PowerfulNumbers36∈\mathrm{PowerfulNumbers}OutTrue\mathrm{True}
live ↗
In12∈PowerfulNumbers12∈\mathrm{PowerfulNumbers}OutFalse\mathrm{False}
About
Examples3
CrosswalkOEIS

See also: Count, At, Element, SquareFreeNumbers, PerfectPowerNumbers