Skip to content

DeficientNumbers ​

The deficient numbers 1,2,3,4,5,7,…1, 2, 3, 4, 5, 7, … -- integers whose proper divisors fall short of them -- as a lazy indexed collection.

DeficientNumbersthe nn with σ(n)−n<n\sigma(n) - n < n, an infinite indexed collection.

Domain: Collections

Details
  • A lazy indexed collection: Count(DeficientNumbers)=+∞Count(DeficientNumbers) = +\infty -- deficient numbers include every prime -- and At(DeficientNumbers,k)At(DeficientNumbers, k) unranks the kk-th by scanning forward from the last cached match.
  • OEIS A005100.
  • Membership goes through Element: Element(7,DeficientNumbers)Element(7, DeficientNumbers) is true, Element(12,DeficientNumbers)Element(12, DeficientNumbers) is false (abundant).

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 (0 if sn_k < 2 else Fold(
                                                                                                        Function(al_a +
                                                                                                                 (al_d if sn_k / al_d ==
                                                                                                                          al_d else al_d +
                                                                                                                                sn_k / al_d) if sn_k % al_d ==
                                                                                                                     0 else al_a, al_a, al_d),
                                                                                                        1,
                                                                                                        Range(2, Floor(Sqrt(sn_k)), 1),
                                                                                                      )) <
                                                                              sn_k else sn_s,
                      sn_s,
                      sn_k,
                    ), 0, Range(1, 3 * (_r + 1), 1)),
     )

rank(_x)

Fold(
      Function(
                sn_c + 1 if (0 if sn_k < 2 else Fold(
                                                      Function(
                                                                al_a +
                                                                (al_d if sn_k /
                                                                         al_d ==
                                                                         al_d else al_d +
                                                                               sn_k /
                                                                               al_d) if sn_k % al_d ==
                                                                    0 else al_a,
                                                                al_a,
                                                                al_d,
                                                              ),
                                                      1,
                                                      Range(
                                                             2,
                                                             Floor(Sqrt(sn_k)),
                                                             1,
                                                           ),
                                                    )) < sn_k else sn_c,
                sn_c,
                sn_k,
              ),
      0,
      Range(1, _x - 1, 1),
    ) if ((0 if _x < 2 else Fold(Function(
                                          al_a +
                                          (al_d if _x / al_d == al_d else al_d +
                                                                          _x /
                                                                          al_d) if _x % al_d == 0 else al_a,
                                          al_a,
                                          al_d,
                                        ), 1, Range(2, Floor(Sqrt(_x)), 1))) < _x if _x >= 1 else False) else -1

valid(_x)

(0 if _x < 2 else Fold(
                        Function(
                                  al_a + (al_d if _x / al_d == al_d else al_d +
                                                                         _x /
                                                                         al_d) if _x %
                                                                              al_d ==
                                                                              0 else al_a,
                                  al_a,
                                  al_d,
                                ),
                        1,
                        Range(2, Floor(Sqrt(_x)), 1),
                      )) < _x if _x >= 1 else False

Enumeration

Examples

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

See also: Count, At, Element, AbundantNumbers, PerfectNumbers