fork download
  1. hoge,ans = [],[]
  2. for i in range(2,10000):
  3. for j in range(2,i):
  4. if i % j == 0: break
  5. else:hoge.append(i)
  6. qqq = int(raw_input())
  7. i,tt = 0,0
  8. while qqq > 1:
  9. if qqq % hoge[i] == 0:
  10. tt+=hoge[i]
  11. qqq/=hoge[i]
  12. continue
  13. i+=1
  14. print tt
Success #stdin #stdout 2.07s 10912KB
stdin
42
stdout
12