Returns the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and 6x, contain the same digits. >>> solution() 142857
()
| 11 | |
| 12 | |
| 13 | def solution(): |
| 14 | """Returns the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and |
| 15 | 6x, contain the same digits. |
| 16 | |
| 17 | >>> solution() |
| 18 | 142857 |
| 19 | """ |
| 20 | i = 1 |
| 21 | |
| 22 | while True: |
| 23 | if ( |
| 24 | sorted(str(i)) |
| 25 | == sorted(str(2 * i)) |
| 26 | == sorted(str(3 * i)) |
| 27 | == sorted(str(4 * i)) |
| 28 | == sorted(str(5 * i)) |
| 29 | == sorted(str(6 * i)) |
| 30 | ): |
| 31 | return i |
| 32 | |
| 33 | i += 1 |
| 34 | |
| 35 | |
| 36 | if __name__ == "__main__": |