Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import itertools
- x = int(input("Podaj liczbe calkowita dodatnia do testu: ")) +1
- listA = list(range(1,x))
- perm = itertools.permutations(listA)
- for i in list(perm):
- y = 0
- for j in range(0,len(i)):
- y += ((sum(i[0:j+1]) / (j+1) % 1 )==0)
- if ((j+1) == len(i) and y == (j+1)):
- print("znaleziono permutacje:" + str(i))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement