import math


def divisor_sum(n):
    """
    Calculates the sum of all divisors of n i.e., σ(n)
    
    Parameters
    ----------
    n : int
        denotes the natural number of which sum of divisors needs to be calculated
    return : int
        returns an integer specifying sum of divisors of n
        
    """
    if(n<=0):
        raise ValueError(
            "n must be a positive integer"
        )
    
    sum = 0
    
    for i in range(1,int(math.sqrt(n))+1):
        if(n%i == 0):
            if(i*i == n):
                sum += i
                continue
            sum += i
            sum += (n//i)
    return sum