Skip to content

Instantly share code, notes, and snippets.

@robbywalker
Created October 21, 2010 23:05

Revisions

  1. robbywalker renamed this gist Oct 21, 2010. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. robbywalker created this gist Oct 21, 2010.
    3 changes: 3 additions & 0 deletions v1_level3.p
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    from itertools import combinations, chain
    nums = tuple([int(v) for v in "3 4 9 14 15 19 28 37 47 50 54 56 59 61 70 73 78 81 92 95 97 99".split(' ') if v.strip()])
    print sum([1 for v in chain(*[combinations(nums, r) for r in range(3, len(nums))]) if sum(v[0:-1]) == v[-1]])