Puzzles and Comments!
First, a note from G.McN. (I’ll always assume , incidentally, that emails we get are fair game for reposting! Let me know if otherwise)
::: The problem :::
You are at a store that sells 6 items of interest, each item costs 1-6 cents, but you do not know which item costs what. How do you purchase these items all at once (so one bill) and figure out the cost of each item?::: The original solution :::
The answer given was to purchase:
– 1 of first item
– 10 of the second item
…
– 100,000 of the sixth item.Then you can look at the columns and find the price of each item. That is all true but the answer is not universal nor efficient.
::: Efficient solution – 6 items :::
Let say you have 6 items with 6 costs, it is more efficient to do it this way. Purchase:
– 1 of the first item
– 7 of the second item
– 49 of the third item
– 343 of the fourth item
– 2,401 of the fifth item
– 16,807 of the sixth item
The way you figure out the cost of each is playing a remainder game. So divide the cost by 16,807 cents and split the answer between the whole number and the remainder. The whole number is the cost of the sixth item. Take the remainder and divide by 2,401. Split the answer into the whole number and the remainder. The whole number is the cost of the fifth item. You can see where this is going …Or, if you want to be fancy, you can take the bill and use a computer (because, to be honest, I am lazy) and convert it to base 7 (as opposed to our base 10 decimal system) and look at the columns.
This maybe being picky of me, but it is much cheaper. If every item can be 6 cents, it is at most $1,176.48 instead of $6,666.66. If every item has to be different, it is at most $1,143.81 instead of $6,543.21. Either way, I would not want to pay that bill …
::: Solution – universal :::
To be universal, let there be n items and i = {1, 2, … n} where i is specific item numbers.Then you purchase n^(i-1) of each item i. Then you can covert the answer into base i+1 and look at the columns.
The most you would pay would turn out to be (if every item could be the same price) n^(i-1) if everything has to be different prices then the sum of i*n^(i-1) over all i, but I do not know how to do that off hand.
That’s it! Further comments below…
We also got this amusing note from J. Kaivosoja
Hi,
and greetings from a snowy Otaniemi, a university campus next to Helsinki, Finland.
Your latest vintage puzzle was, as you predicted, quite easy. [[…]]
I’ve got some puzzles for you, too. Feel free to use them in your podcast (and radio show) and/or on your site.
First, an easy one. How are these numbers arranged?
8 5 4 9 1 7 6 3 2 0
[spoiler] Quite easy – alphabetically. [/spoiler]How about these?
8 2 3 6 4 0 7 5 9 1
[spoiler]Again, alphabetically, but this time in my native Finnish. I can imagine that’d be a real head-scratcher for anyone who doesn’t speak the language.[/spoiler]This one I like to give to my friends. How are these letters arranged?
Y S U L E A M I K N G T H R Z
[spoiler]Very few people know them all by heart – these are the commuter train routes in the Helsinki region (I’m a public transport enthusiast, myself).
http://www.vr.fi/eng/aikataulut/reittikartat/lahiliikenne.shtml [/spoiler]
I’m not sure if this last one would work in radio – it might be a bit too visual. How are these letters arranged into two groups?
A EF HI KLMN
—————
BCD G J O
[spoiler]The ones below the dotted line are those with curvy lines.[spoiler]I absolutely love your podcast – it’s kept me entertained for many a dull bus ride, and I’ve tried some of the coin and card tricks you’ve shown on my family, many of whom have since expressed interest in the podcast. Keep up the good work!
Juho Kaivosoja
Espoo, Finland
(the j’s are soft)
Wow, thanks for the great emails!
Chaim
strauss said,
March 23, 2010 at 4:11 pm
I didn’t want to hold up J.Kaivojosa’s email, so want to comment on G.McN’s note here.
The technique is totally correct, but does it require that no item cost more than your n? Our problem was set up a little differently– we know the cost is as much as 10 cents, and the technique we have will work up to 10 items. In other words, n has to be the max of the costs and the number of possible different items.
Unless I’m missing something obvious of course!
Thanks for a great email,
Chaim
Greg McNerney said,
March 24, 2010 at 10:14 am
( tried leaving a comment before but something messed up )
Hi! I was pleasantly surprised to her my name on the podcast :)!
I think that the answer is universal. The only two things you need to know is the highest possible cost item and the total number of items. The highest cost plus 1 is the base system used (in the problem 6+1 = 7) and the number of items determines the order in which this is done (like the number of columns before). I do not even think that the prices need to be ordered. I mean, it could be 10 items from 1-100 cents or 100 items from 1-10 cents. My convictions come from the fact that it is not using a pre-determined base (like the decimal system of 10) but adjusts to the problem. Also, each value is determined independently of each other, there is no influence from other answers.
I could be wrong though …
Also, amusingly, I am like Juho as I am currently visiting a university in Finland. (Jyväskylä … have fun pronouncing that!)
Michael said,
July 27, 2010 at 5:55 pm
There is actually a more efficient solution to the above puzzle.
I was initially puzzled, because 6 items of price 1-6 gives 6^6 possible combinations, or 46656 combinations. If each of these costs 1 cent more than the one below it, then the highest priced combination would cost $466.56, and not $1,176.48. It took me some time to figure out if this can be done. It can, almost.
The solution in the end is simple: take base 6, instead of base 7. Then, if all costs 1 cents, you pay 1+6+.36+216+1296+7776 =9331 cents, or in base 6
111111 cents.
Then you go up to 111112, 11113, etc, up to 111120 if the 1st item costs 6 cents.
If the 2nd item costs 2 cents, we would read
111121, so this wouldn’t overlap with this previous possibility.
The way to read the answer is a bit more complicated, but hints at why this works.
Take the price, subtract 111111 base 6. Then, as in the previous answer, read the price off digit by digit, but then add one to each digit to get the real price.
So, 111120-111111=000005 (base 6), and therefore the prices are 1,1,1,1,1,6
and 111121-111111=000010 (base 6), so the prices are 1,1,1,1,2,1.
This has you pay a maximum of $559.86
Still quite a lot, but less.
I think this is the optimal answer, though theoretically $466.56 is the lowest possible.