Returns the first integer whose square is of the form 1_2_3_4_5_6_7_8_9_0
()
| 56 | |
| 57 | |
| 58 | def solution() -> int: |
| 59 | """ |
| 60 | Returns the first integer whose square is of the form 1_2_3_4_5_6_7_8_9_0 |
| 61 | """ |
| 62 | num = 138902663 |
| 63 | |
| 64 | while not is_square_form(num * num): |
| 65 | if num % 10 == 3: |
| 66 | num -= 6 # (3 - 6) % 10 = 7 |
| 67 | else: |
| 68 | num -= 4 # (7 - 4) % 10 = 3 |
| 69 | |
| 70 | return num * 10 |
| 71 | |
| 72 | |
| 73 | if __name__ == "__main__": |