Advertisement
Guest User

Untitled

a guest
Sep 14th, 2014
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from time import time
  2. st = time()
  3.  
  4. goal = 1000
  5. n = goal
  6. solutions = 0
  7.  
  8. while solutions <= goal:
  9.     solutions = 0
  10.     for x in range(n + 1, 2*n + 1):
  11.         y, rem = divmod(x * n, x - n)
  12.         if rem == 0:
  13.             solutions += 1
  14.  
  15.     if n % 1000 == 0:
  16.         print('n = {:5}, solutions: {:4}, time is {:6.3f}'.format(n, solutions, time() - st))
  17.     n += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement