KFreeIntegers
The -free integers -- naturals with no prime factor raised to the -th power or higher -- as a lazy indexed family, one collection per .
KFreeIntegers(k)the positive integers whose every prime factor has exponent , an infinite indexed collection.Typed signatures
| Type | Package | Applies |
|---|---|---|
(integer<0..>) -> indexed_collection<integer> | combinatorics | always |
Details
- A lazy indexed collection for each : , and unranks the -th by scanning forward, testing each candidate's factorisation against .
- is exactly SquareFreeNumbers (A005117); is the cube-free numbers, A004709.
- Membership goes through Element: is false (, exponent ), is true.
Definition
Epsil, as the implementation runs it.
count(_k)
1 if _k < 2 else PositiveInfinityunrank(_k, _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 (sn_k ==
1 if _k < 2 else Fold(
Function(ok_kf &&
sn_k %
kf ^ _k !=
0, ok_kf, kf),
True,
Range(2, Floor(Sqrt(sn_k)), 1),
)) else sn_s,
sn_s,
sn_k,
), 0, Range(1, 1 if _k < 2 else 2 * (_r + 1), 1)),
)rank(_k, _x)
Fold(
Function(sn_c + 1 if (sn_k == 1 if _k < 2 else Fold(
Function(
ok_kf && sn_k %
kf ^
_k !=
0,
ok_kf,
kf,
),
True,
Range(
2,
Floor(Sqrt(sn_k)),
1,
),
)) else sn_c, sn_c, sn_k),
0,
Range(1, _x - 1, 1),
) if ((_x == 1 if _k < 2 else Fold(
Function(
ok_kf && _x % kf ^ _k != 0,
ok_kf,
kf,
),
True,
Range(2, Floor(Sqrt(_x)), 1),
)) if _x >= 1 else False) else -1valid(_k, _x)
(_x == 1 if _k < 2 else Fold(
Function(ok_kf && _x % kf ^ _k != 0, ok_kf, kf),
True,
Range(2, Floor(Sqrt(_x)), 1),
)) if _x >= 1 else FalseEnumeration
Examples
1 more kept as data, checked against the oraclesAbout
| Examples | 2 |
|---|
See also: Count, At, Element, SquareFreeNumbers