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
format with black
  • Loading branch information
Takosaga committed Oct 24, 2020
commit 7a39da3205795483a693cad1d33a42f4b62c30a6
10 changes: 6 additions & 4 deletions project_euler/problem_206/sol1.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,27 @@

import math


def solution() -> int:
"""
>>> solution()
1389019170
"""

#adding odds
# adding odds
total = 1
add = 1

while True:

#adding odds
# adding odds
add += 2
total += add

#starts count here since the bottom limit
# 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,5 +48,6 @@ def solution() -> int:

return int(math.sqrt(total))


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