summaryrefslogtreecommitdiff
path: root/progs/a252.py
blob: 763188556cb2cc726f82ebfd27b296a9fbb5176b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import math
def sum_of_odd_Factors(n): 
    res = 1
    while n % 2 == 0: 
        n = n // 2 
    for i in range(3,int(math.sqrt(n) + 1)): 
        count = 0
        curr_sum = 1
        curr_term = 1
        while n % i == 0: 
            count+=1 
            n = n // i 
            curr_term *= i 
            curr_sum += curr_term    
        res *= curr_sum  
    if n >= 2: 
        res *= (1 + n) 
    return res