Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from itertools import combinations
- import numpy as np
- def C(n, k):
- return len(list(combinations(range(1, n), k)))
- n = 10
- matrix = []
- for i in range(1, n+1):
- line = []
- for j in range(1, n+1):
- if i >= j:
- result = C(i, j)
- else:
- result = C(j, i)
- line.append(result)
- matrix.append(line.copy())
- print(np.array(matrix))
Add Comment
Please, Sign In to add comment