diff --git a/project_euler/problem_45/sol1.py b/project_euler/problem_45/sol1.py index ed66e6fab210..70750a3b6fc9 100644 --- a/project_euler/problem_45/sol1.py +++ b/project_euler/problem_45/sol1.py @@ -1,4 +1,6 @@ """ +https://projecteuler.net/problem=45 + Triangle, pentagonal, and hexagonal numbers are generated by the following formulae: Triangle T(n) = (n * (n + 1)) / 2 1, 3, 6, 10, 15, ... Pentagonal P(n) = (n * (3 * n − 1)) / 2 1, 5, 12, 22, 35, ... @@ -39,10 +41,10 @@ def is_pentagonal(n: int) -> bool: return ((1 + root) / 6) % 1 == 0 -def compute_num(start: int = 144) -> int: +def solution(start: int = 144) -> int: """ Returns the next number which is traingular, pentagonal and hexagonal. - >>> compute_num(144) + >>> solution(144) 1533776805 """ n = start @@ -54,4 +56,4 @@ def compute_num(start: int = 144) -> int: if __name__ == "__main__": - print(f"{compute_num(144)} = ") + print(f"{solution(144)} = ")