fork download
  1. def fact(n, memo={}):
  2. if n == 0: return 1
  3. if n not in memo:
  4. memo[n] = n * fact(n-1, memo)
  5. return memo[n]
  6.  
  7. def is_prime(n):
  8. return fact(n-1) % n == n-1
  9.  
  10. print(sum(x for x in range(1,10001) if not is_prime(x)))
Success #stdin #stdout 1.17s 10928KB
stdin
Standard input is empty
stdout
44268603