# GeekDad Puzzle of the Week Solution: A Weighty Proposition

The puzzle as previously presented:

After running afoul of the law in a foreign country, Wyoming Smith (not the guy with a similar name from the Harrison Ford movies) is presented with a logic problem: solve the riddle, or be force-fed crackers until he perishes. (“Snacks? Why does it always have to be snacks??!?” he cried.) The local magistrate offered the following problem:

Before you is a pan balance. Using at most ten (10) different scale weights, how many different consecutive values of weights can you measure exactly? Use only whole number units of grams, and any gaps in numbers available will end your count.

Wyoming solved the problem quickly, and was almost on his way when he spied the magistrate’s magnificent hat. “Double or nothing for the chapeau,” said Wyoming.

The magistrate quickly agreed, and re-issued the same challenge, but allowed Wyoming to place weights on both sides of the pan balance.

Wyoming once again solved the problem quickly, and was on his way with his new lid.

For your chance at this week’s \$50 ThinkGeek gift certificate, there are two questions:

How did Wyoming Smith save his life? That is, what weight sizes (in whole number units of grams) did he select, and with them, how many different consecutive measures could he create using only one side of the pan balance?
How did Wyoming Smith gain the magistrate’s hat? What weight sizes (in whole number units of grams) did he select, and with them, how many different consecutive measures could he create using both sides of the pan balance?

Note that in both cases, Wyoming could use at most ten (10) difference scale weights.

The solution for this weighty proposition is based in, well, number bases. Using just one side of the balance for weights, Wyoming picked his weight values as the powers of 2: 2^0=1, 2^1=2, 2^2=4, 2^3=8, … 2^9=512. To represent any value from 0 to 1023, simply translate the number to binary, and include/exclude that base-2 digit value on the pan. For example, 218 in base-2 is 0011011010. To weight out 218 grams, only include (from right to left) 2, 8, 16, 64, and 128. The most that can be weighed in this manner is 1023 grams, the sum of 1+2+4+8+ … +512.

The second portion of the puzzle (that which won him the hat) is a little trickier, as both sides of the pan balance could be used to hold weights. Here, Wyoming picked his weight values as the powers of 3: 3^0=1, 3^1=3, 3^2=9, 3^3=27 … 3^9=19683. By translating the number to ternary (base-3), you can identify which weights are included against the item being weighed, with the item being weighed, and not included at all would be represented by each digit type within the number. However, instead of using 0, 1, and 2 for the digits, simply use 1, -1, and 0. For example, that same 218 could be represented 10(-1)01(-1) as -1+3-27+243 = 218. This numbering system is called “balanced ternary,” and is really useful in some fields of logic and number theory.

Most of the submissions sent in included the binary and ternary number systems, and several even included references to the “balanced ternary” system. Where a lot of people mis-stepped, however, was in calculating the total measurable. Unlike binary numbers, where everything is additive, balanced ternary numbers “borrow” from the next higher early; for example, to count to 8 in balanced, we need the “9” as early as 5, to perform (-1-3+9.) Therefore, the largest number you can represent with a 10-digit balanced ternary number is 3^10-1. Wyoming simply calculated the sum of his weights and got the total of 29524 grams as his maximum.

SuperAwesomeMan

Not only did Wyoming leverage the right method and get the right total, but so did Matthew Kunzman, the winner of this week’s \$50 ThinkGeek gift certificate. While Matthew did not send in a photo of himself in a hat, he did send an amazing image of the (in)famous SuperAwesomeMan. SuperAwesomeMan has the power to shoot ninjas out of his palm. Really. (Apparently, they make a “PEW PEW” noise, similar to lasers.)

In any case, congratulations to Matthew, and many thanks to everyone that entered this week’s puzzle.