Guest User

Untitled

a guest
Oct 28th, 2011
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. >>>
  2. >>> import itertools as it
  3. >>> a, d, b, g, e, c, f = range(7)
  4. >>> for s in it.permutations(range(1, 10), 7):
  5.     if s[a]*s[b]*s[c] == s[b]*s[g]*s[e] == s[d]*s[e]*s[f]:
  6.         print s
  7.  
  8.        
  9. (1, 3, 9, 2, 4, 8, 6)
  10. (1, 6, 9, 2, 4, 8, 3)
  11. (3, 1, 4, 2, 9, 6, 8)
  12. (3, 8, 4, 2, 9, 6, 1)
  13. (6, 1, 4, 2, 9, 3, 8)
  14. (6, 8, 4, 2, 9, 3, 1)
  15. (8, 3, 9, 2, 4, 1, 6)
  16. (8, 6, 9, 2, 4, 1, 3)
  17. >>>
  18.  
Advertisement
Add Comment
Please, Sign In to add comment