Skip to content

RoughNumbers ​

The kk-rough numbers -- positive integers with no prime factor below kk -- as a lazy indexed family, one collection per kk (SmoothNumbers's mirror image).

RoughNumbers(k)the n≥1n \geq 1 whose prime factors are all ≥k\geq k (n=1n=1 counts, vacuously), an infinite indexed collection for every kk.
Typed signatures
TypePackageApplies
(integer<0..>) -> indexed_collection<integer>combinatoricsalways

Domain: Collections

Details
  • A lazy indexed collection for each kk: Count(RoughNumbers(k))=+∞Count(RoughNumbers(k)) = +\infty -- every sufficiently large prime is kk-rough. RoughNumbers(5)RoughNumbers(5) is OEIS A007310 (coprime to 6); RoughNumbers(7)RoughNumbers(7) is A007775 (coprime to 30).
  • At(RoughNumbers(k),i)At(RoughNumbers(k), i) unranks the ii-th match by scanning forward, factoring each candidate -- At(RoughNumbers(5),1)=1At(RoughNumbers(5), 1) = 1 (vacuously rough).
  • Membership goes through Element: Element(35,RoughNumbers(5))Element(35, RoughNumbers(5)) is true (5×75\times7, both ≥5\geq5), Element(15,RoughNumbers(5))Element(15, RoughNumbers(5)) is false (3×53\times5, 3<53<5).

Definition

Epsil, as the implementation runs it.

count(_k)

PositiveInfinity

unrank(_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 Fold(
                                                                                     Function(ok_rf &&
                                                                                              sn_k % rf !=
                                                                                              0, ok_rf, rf),
                                                                                     True,
                                                                                     Range(2, _k - 1, 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 if _k < 1 else _k),
                         ),
                    1,
                  ),
           ),
     )

rank(_k, _x)

Fold(Function(sn_c + 1 if Fold(
                                Function(ok_rf && sn_k % rf != 0, ok_rf, rf),
                                True,
                                Range(2, _k - 1, 1),
                              ) else sn_c, sn_c, sn_k), 0, Range(1, _x - 1, 1)) if (Fold(
                                                                                         Function(ok_rf &&
                                                                                                  _x % rf !=
                                                                                                  0, ok_rf, rf),
                                                                                         True,
                                                                                         Range(2, _k - 1, 1),
                                                                                       ) if _x >= 1 else False) else -1

valid(_k, _x)

Fold(Function(ok_rf && _x % rf != 0, ok_rf, rf), True, Range(2, _k - 1, 1)) if _x >=
                                                                               1 else False

Enumeration

Examples

1 more kept as data, checked against the oracles
About
Examples1

See also: Count, At, Element, SmoothNumbers, KAlmostPrimes