Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
trim trailing whitespace
  • Loading branch information
Takosaga committed Oct 24, 2020
commit e54acff20115fcdd8bb9c7e6717831656ed04f5c
12 changes: 6 additions & 6 deletions project_euler/problem_206/sol1.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
Find the unique positive integer whose square has the form 1_2_3_4_5_6_7_8_9_0,
where each “_” is a single digit.

Solution: Finding a square number can found by adding consecutive odd numbers
Solution: Finding a square number can found by adding consecutive odd numbers
starting from 1. The minimum number possible for perfect square is 1020304050607080900
in this situation, so started checking digits are in correct places after
total is above it.
in this situation, so started checking digits are in correct places after
total is above it.

"""

import math
import math

def solution() -> int:
"""
Expand All @@ -32,7 +32,7 @@ def solution() -> int:
#starts count here since the bottom limit
if total > 1020304050607080900:

#nested if statements to check digits
#nested if statements to check digits
num = str(total)
if int(num[-1]) == 0:
if int(num[-3]) == 9:
Expand All @@ -47,6 +47,6 @@ def solution() -> int:
break

return int(math.sqrt(total))

if __name__ == "__main__":
print(f"{solution() = }")
Comment thread
Takosaga marked this conversation as resolved.