Skip to content
Vamshi Jandhyala

Books · The Riddler

Chapter 55

Can You Slice The Ice?

A menorah has a central shamash with four numbered candles to its left and four to its right: the pair nearest the shamash are both “11,” the next pair out “22,” then “33,” then “44” at the ends. The shamash is always lit. In how many ways can you light some of the other eight candles so the lit numbers sum to the same total on each side? (Lighting candle 11 and 44 on one side, 22 and 33 on the other, both summing to 55, is one such way.)

Solution

A lit pattern picks a subset LL of {1,2,3,4}\{1,2,3,4\} on the left and a subset RR on the right, and it is balanced when the two have equal sums. So count, for each possible common total ss, how many subsets of {1,2,3,4}\{1,2,3,4\} sum to ss; the left and right choices are independent, so that count is squared.

The subset sums of {1,2,3,4}\{1,2,3,4\} split up as: one subset each for sums 11 and 22; two each for sums 3,4,5,6,73,4,5,6,7; one each for sums 8,9,108,9,10. (Sum 00 is the empty side, which would leave that side dark, so we drop it.) Squaring and adding the positive totals, 12+12+22+22+22+22+22s=3,,7+12+12+12=2+20+3=25.1^2 + 1^2 + \underbrace{2^2 + 2^2 + 2^2 + 2^2 + 2^2}_{s = 3,\dots,7} + 1^2 + 1^2 + 1^2 = 2 + 20 + 3 = \boxed{25}.

The computation

Enumerate every way to light a nonempty set among the eight candles and keep those whose left and right lit numbers sum to the same total.

from itertools import product, combinations
candles = list(product(["l", "r"], range(1, 5)))   # (side, number)
def side(comb, s): return sum(i for t, i in comb if t == s)
count = 0
for k in range(2, len(candles) + 1):
    for comb in combinations(candles, k):
        if side(comb, "l") == side(comb, "r"):
            count += 1
print(count)                                        # 25