def amicable_pairs(): """ Amicable Pairs: Pairs of numbers which are each the Aliquot sum of the other\n OEIS A063990 """ for n in naturals(284): b = aliquot_sum(n) if b >= n: continue if aliquot_sum(b) == n: yield b,n
def aliquot(): """ Aliquot Numbers: Sum of proper divisors for each positive integer\n OEIS A001065 """ for n in naturals(1): yield aliquot_sum(n)
def deficiency(): """ Deficiency: Each positive integer minus its aliquot sum\n OEIS A033879 """ for n in naturals(1): yield n-aliquot_sum(n)
def abundance(): """ Abundance: The aliquot sum of each positive number minus that number\n OEIS A033880 """ for n in naturals(1): yield aliquot_sum(n)-n
def abundant(): """ Abundant Numbers: Positive integers that are less than their aliquot sum\n OEIS A005101 """ for n in naturals(1): if aliquot_sum(n) > n: yield n
def deficient(): """ Deficient Numbers: Positive integers that are greater than their aliquot sum\n OEIS A005100 """ for n in naturals(1): if aliquot_sum(n) < n: yield n
def aliquot_recurrence(n): """ Aliquot Sequence of n: Recurrence relation of which each term of the aliquot sum of the previous Args: n -- integer greater than zero OEIS """ require_integers(["n"],[n]) require_geq(["n"],[n],1) while True: yield n n = aliquot_sum(n)
def untouchable(): """ Untouchable Numbers: Non-negative integers that cannot be an aliquot sum\n OEIS A005114 """ seen = set({}) lo, hi = 3,3 for n in naturals(2): hi = (n-1)**2 for k in range(lo,hi+1): seen.add(aliquot_sum(k)) if n not in seen: yield n lo = hi
def touchable(): """ Touchable Numbers: Non-negative integers that can be an aliquot sum\n OEIS A078923 """ seen = set({}) lo, hi = 3,3 yield 0 yield 1 for n in naturals(3): hi = (n-1)**2 for k in range(lo,hi+1): seen.add(aliquot_sum(k)) if n in seen: yield n lo = hi