mirror of
https://github.com/Andreabont/PyExperiments.git
synced 2024-11-08 11:51:44 +00:00
13 lines
296 B
Python
13 lines
296 B
Python
|
def foundDivisors(x):
|
||
|
for i in range(1,abs(x)+1):
|
||
|
if x % i == 0:
|
||
|
yield i
|
||
|
|
||
|
def foundFactors(x, n, found=[]):
|
||
|
if n <= 1:
|
||
|
return [found+[x]]
|
||
|
ret = []
|
||
|
for d in foundDivisors(x):
|
||
|
ret += foundFactors(int(x/d), n-1, found+[d])
|
||
|
return ret
|