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

Function run

project_euler/problem_047/sol1.py:72–98  ·  view source on GitHub ↗

Runs core process to find problem solution. >>> run(3) [644, 645, 646]

(n: int)

Source from the content-addressed store, hash-verified

70
71
72def run(n: int) -> list[int]:
73 """
74 Runs core process to find problem solution.
75 >>> run(3)
76 [644, 645, 646]
77 """
78
79 # Incrementor variable for our group list comprehension.
80 # This is the first number in each list of values
81 # to test.
82 base = 2
83
84 while True:
85 # Increment each value of a generated range
86 group = [base + i for i in range(n)]
87
88 # Run elements through the unique_prime_factors function
89 # Append our target number to the end.
90 checker = [upf_len(x) for x in group]
91 checker.append(n)
92
93 # If all numbers in the list are equal, return the group variable.
94 if equality(checker):
95 return group
96
97 # Increment our base variable by 1
98 base += 1
99
100
101def solution(n: int = 4) -> int | None:

Callers 1

solutionFunction · 0.70

Calls 3

upf_lenFunction · 0.85
equalityFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected