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

Function question_function

project_euler/problem_101/sol1.py:164–188  ·  view source on GitHub ↗

The generating function u as specified in the question. >>> question_function(0) 1 >>> question_function(1) 1 >>> question_function(5) 8138021 >>> question_function(10) 9090909091

(variable: int)

Source from the content-addressed store, hash-verified

162
163
164def question_function(variable: int) -> int:
165 """
166 The generating function u as specified in the question.
167 >>> question_function(0)
168 1
169 >>> question_function(1)
170 1
171 >>> question_function(5)
172 8138021
173 >>> question_function(10)
174 9090909091
175 """
176 return (
177 1
178 - variable
179 + variable**2
180 - variable**3
181 + variable**4
182 - variable**5
183 + variable**6
184 - variable**7
185 + variable**8
186 - variable**9
187 + variable**10
188 )
189
190
191def solution(func: Callable[[int], int] = question_function, order: int = 10) -> int:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected