示例#1
0
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
示例#2
0
def aliquot():
    """
    Aliquot Numbers: Sum of proper divisors for each positive integer\n
    OEIS A001065
    """
    
    for n in naturals(1):
        yield aliquot_sum(n)
示例#3
0
def deficiency():
    """
    Deficiency: Each positive integer minus its aliquot sum\n
    OEIS A033879
    """
    
    for n in naturals(1):
        yield n-aliquot_sum(n)
示例#4
0
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
示例#5
0
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
示例#6
0
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
示例#7
0
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)
示例#8
0
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
示例#9
0
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