PrimePowerNumbers
The prime powers : for a prime and (excluding 1, which is ).
OEIS
A246655mathlib4IsPrimePowPrimePowerNumbersthe for a prime and integer , an infinite indexed collection.Details
- A lazy indexed collection: (PrimeNumbers alone already is). OEIS A246655.
- unranks by scanning forward, factoring each candidate -- ().
- Membership goes through Element: is true (), is false (, two distinct primes).
Definition
Epsil, as the implementation runs it.
count()
PositiveInfinityunrank(_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 Apply(
(fw_e: list<integer>) => fw_e[4] +
(1 if fw_e[1] > 1 &&
!(fw_e[1] == fw_e[2] &&
fw_e[5] == 1) else 0) ==
1,
Fold(
Function(fw_w if fw_w[2] * fw_w[2] >
fw_w[1] else [
fw_w[1] / fw_w[2],
fw_w[2],
fw_w[3] + 1,
fw_w[4] +
(1 - fw_w[5]),
1,
] if fw_w[1] % fw_w[2] ==
0 else [fw_w[1], fw_w[2] + 1, fw_w[3], fw_w[4], 0], fw_w, fw_i),
[sn_k, 2, 0, 0, 0],
Range(1, Floor(Sqrt(sn_k)) +
Floor(Log(sn_k, 2)) +
2, 1),
),
) else sn_s, sn_s, sn_k),
0,
Range(
1,
Apply(
(pb_n: integer) => 11 if pb_n < 6 else Floor(pb_n *
(Ln(pb_n) +
Ln(Ln(pb_n)))) + 1,
_r + 1,
),
1,
),
),
)rank(_x)
Fold(Function(sn_c + 1 if Apply(
(fw_e: list<integer>) => fw_e[4] +
(1 if fw_e[1] > 1 &&
!(fw_e[1] ==
fw_e[2] && fw_e[5] ==
1) else 0) == 1,
Fold(
Function(fw_w if fw_w[2] * fw_w[2] >
fw_w[1] else [
fw_w[1] /
fw_w[2],
fw_w[2],
fw_w[3] + 1,
fw_w[4] + (1 -
fw_w[5]),
1,
] if fw_w[1] %
fw_w[2] == 0 else [
fw_w[1],
fw_w[2] +
1,
fw_w[3],
fw_w[4],
0,
], fw_w, fw_i),
[sn_k, 2, 0, 0, 0],
Range(1, Floor(Sqrt(sn_k)) +
Floor(Log(sn_k, 2)) + 2, 1),
),
) else sn_c, sn_c, sn_k), 0, Range(1, _x - 1, 1)) if (Apply(
(fw_e: list<integer>) => fw_e[4] +
(1 if fw_e[1] > 1 &&
!(fw_e[1] == fw_e[2] &&
fw_e[5] == 1) else 0) ==
1,
Fold(
Function(fw_w if fw_w[2] * fw_w[2] >
fw_w[1] else [
fw_w[1] / fw_w[2],
fw_w[2],
fw_w[3] + 1,
fw_w[4] +
(1 - fw_w[5]),
1,
] if fw_w[1] % fw_w[2] ==
0 else [fw_w[1], fw_w[2] + 1, fw_w[3], fw_w[4], 0], fw_w, fw_i),
[_x, 2, 0, 0, 0],
Range(1, Floor(Sqrt(_x)) +
Floor(Log(_x, 2)) +
2, 1),
),
) if _x >= 1 else False) else -1valid(_x)
Apply(
(fw_e: list<integer>) => fw_e[4] + (1 if fw_e[1] > 1 && !(fw_e[1] ==
fw_e[2] && fw_e[5] ==
1) else 0) ==
1,
Fold(
Function(
fw_w if fw_w[2] * fw_w[2] > fw_w[1] else [
fw_w[1] /
fw_w[2],
fw_w[2],
fw_w[3] + 1,
fw_w[4] + (1 -
fw_w[5]),
1,
] if fw_w[1] %
fw_w[2] == 0 else [
fw_w[1],
fw_w[2] + 1,
fw_w[3],
fw_w[4],
0,
],
fw_w,
fw_i,
),
[_x, 2, 0, 0, 0],
Range(1, Floor(Sqrt(_x)) + Floor(Log(_x, 2)) + 2, 1),
),
) if _x >= 1 else FalseEnumeration
Examples
1 more kept as data, checked against the oracles See also: Count, At, Element, PrimeNumbers, KAlmostPrimes