Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def primeFactors(n):
- factors = []
- lastresult = n
- while 1:
- if lastresult == 1:
- break
- c = 2
- while 1:
- if lastresult % c == 0:
- break
- c += 1
- factors.append(c)
- lastresult /= c
- return factors
- def run(n):
- bad = []
- sum = 0.0
- for i in range(30, n, 30):
- li = primeFactors(i)
- for el in li:
- if (el != 2) and (el != 3) and (el != 5):
- bad.append(i)
- for i in range(30, n, 30):
- if i not in bad:
- sum += 1.0/i
- return sum
- # run(10000000)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement