summaryrefslogtreecommitdiff
path: root/progs/a84.py
blob: f7e6c29a267edd19c26bc99b062e2b61d0abdd1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
def sum_Of_Primes(n): 
    prime = [True] * (n + 1)  
    p = 2
    while p * p <= n: 
        if prime[p] == True:  
            i = p * 2
            while i <= n: 
                prime[i] = False
                i += p 
        p += 1    
    sum = 0
    for i in range (2,n + 1): 
        if(prime[i]): 
            sum += i 
    return sum