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

Function solution

project_euler/problem_203/sol1.py:100–113  ·  view source on GitHub ↗

Returns the sum of squarefrees for a given Pascal's Triangle of depth n. >>> solution(1) 1 >>> solution(8) 105 >>> solution(9) 175

(n: int = 51)

Source from the content-addressed store, hash-verified

98
99
100def solution(n: int = 51) -> int:
101 """
102 Returns the sum of squarefrees for a given Pascal's Triangle of depth n.
103
104 >>> solution(1)
105 1
106 >>> solution(8)
107 105
108 >>> solution(9)
109 175
110 """
111 unique_coefficients = get_pascal_triangle_unique_coefficients(n)
112 squarefrees = get_squarefrees(unique_coefficients)
113 return sum(squarefrees)
114
115
116if __name__ == "__main__":

Callers 1

sol1.pyFile · 0.70

Calls 2

get_squarefreesFunction · 0.85

Tested by

no test coverage detected