Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
16
Task/Factorions/Python/factorions.py
Normal file
16
Task/Factorions/Python/factorions.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
fact = [1] # cache factorials from 0 to 11
|
||||
for n in range(1, 12):
|
||||
fact.append(fact[n-1] * n)
|
||||
|
||||
for b in range(9, 12+1):
|
||||
print(f"The factorions for base {b} are:")
|
||||
for i in range(1, 1500000):
|
||||
fact_sum = 0
|
||||
j = i
|
||||
while j > 0:
|
||||
d = j % b
|
||||
fact_sum += fact[d]
|
||||
j = j//b
|
||||
if fact_sum == i:
|
||||
print(i, end=" ")
|
||||
print("\n")
|
||||
Loading…
Add table
Add a link
Reference in a new issue