SHOW:
|
|
- or go back to the newest paste.
| 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 | - | if (x * n) % (x - n) == 0: |
| 13 | + | |
| 14 | ||
| 15 | if n % 1000 == 0: | |
| 16 | print('n = {:5}, solutions: {:4}, time is {:6.3f}'.format(n, solutions, time() - st))
| |
| 17 | n += 1 |