All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Weighing Coins (Posted on 2007-02-21)
There are five bags of coins such that:

a) the weight of any coin (in ounces) is a positive integer less than or equal to w
b) all coins in a given bag weigh the same
c) the weight of a coin in bag #1 is different from the weight of a coin in bag #2
d) when one coin from bag #1, w coins from bag #2, w2 coins from bag #3, w3 coins from bag #4, and w4 coins from bag #5 are combined and weighed, the result is 2800 ounces

Determine analytically, the weight of a coin in each of the five bags.

 See The Solution Submitted by Dennis No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 solution | Comment 1 of 5

The weight of each coin can be considered a digit in a variant of base-w representation.  In the usual base-w representation, digits can be from 0 to w-1, but in this variation, they go from 1 to w.

The usual base conversion method is to divide the number by the base. The remainder becomes the first (or next) digit, placed to the left of any preciding digits found, and then using the quotient as the new dividend for the process to continue.

In this case, we must convert any zero remainders to w. At the same time, we must subtract 1 from the quotient before using it as the next dividend, to account for the "borrowing" done.

As the powers of the base go from zero to four, we need a 5-digit number in the peculiar base-w system to represent 2800 decimal.  So we can try various bases.  The following table shows this base-w representation for various w:

` 2           12122221112 3           3211131 4           223234 5           42145 6           16544 7           7777 8           5358 9           375110           279a11           211612           175413           137514           e3e15           c6a16           aeg17           9bc18           8ba19           7e720           6jk`

Note that a=10, b=11, c=12, etc. in decimal representation.

So for the base w being 5 or 6, we get a 5-digit representation of 2800 decimal.

As the lower powers of w are on the right in interpreting the numbers, bag 1 is represented by the rightmost digit and bag 5 by the leftmost.

When the base is 6, the rightmost two digits are the same, and thus bags 1 and 2 would have the same weight coins so this possibility is disqualified.

So the weights of the coins in bags 1 through 5 are 5, 4, 1, 2 and 4 respectively.

The following program tries the bases, b, from 2 to 20, resulting in the above table:

CLS
n = 2800
FOR b = 2 TO 20
m = n
ns\$ = ""

DO
d = m MOD b
m = m \ b
IF d = 0 THEN d = b: m = m - 1
ns\$ = MID\$("0123456789abcdefghijklmnopqrstuvwxyz", d + 1, 1) + ns\$
LOOP UNTIL m = 0
PRINT b, ns\$
NEXT b

 Posted by Charlie on 2007-02-21 17:01:05

 Search: Search body:
Forums (0)