-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path650.txt
More file actions
32 lines (27 loc) · 757 Bytes
/
Copy path650.txt
File metadata and controls
32 lines (27 loc) · 757 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import math
from itertools import combinations
def factorial(n):
return 1 if (n == 1 or n == 0) else n * factorial(n - 1)
def printDivisors(array, n) :
sqrt = n ** .5
for i in range(1 , int(sqrt + 1)):
if n % i == 0:
array.add(int(n / i))
array.add(i)
return array
def print_powerset(string):
for i in range(0,len(string)+1):
for element in combinations(string,i):
print(''.join(element))
string=['a','b','c']
print_powerset(string)
result = 0
for i in range(1, 101):
x = 1
for j in range(1, i):
x *= (factorial(i) / (factorial(i - j) * factorial(j)))
print(x)
array = printDivisors(set(), x)
#print(array, x)
result += sum(array)
print(result)