MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / solution

Function solution

project_euler/problem_012/sol1.py:41–58  ·  view source on GitHub ↗

Returns the value of the first triangle number to have over five hundred divisors. >>> solution() 76576500

()

Source from the content-addressed store, hash-verified

39
40
41def solution():
42 """Returns the value of the first triangle number to have over five hundred
43 divisors.
44
45 >>> solution()
46 76576500
47 """
48 t_num = 1
49 i = 1
50
51 while True:
52 i += 1
53 t_num += i
54
55 if count_divisors(t_num) > 500:
56 break
57
58 return t_num
59
60
61if __name__ == "__main__":

Callers 1

sol1.pyFile · 0.70

Calls 1

count_divisorsFunction · 0.70

Tested by

no test coverage detected