Go Back   Freethought Forum > The Amphitheater > The Colosseum

Reply
 
Thread Tools Display Modes
  #1  
Old 08-29-2024, 03:27 PM
ceptimus's Avatar
ceptimus ceptimus is offline
puzzler
 
Join Date: Aug 2004
Location: UK
Posts: XVMMMX
Images: 28
Default 7-11 puzzle

A customer goes into a 7-Eleven store and chooses four items. The guy at the checkout charges him $7.11

Intrigued by the coincidence, the customer asks how the total was arrived at, and the clerk tells him he simply multiplied the prices of the four items together.

"Multiplied!" says our hero, "But you're supposed to add!"

The clerk apologises and does the calculation again, but the total is still $7.11

What were the prices of the four items?



I asked my nephew this puzzle the other day, but I'd misremembered the number of items, and told him it was three. When he couldn't solve it, I googled the answer, and sent him the four-item solution, but this got me wondering whether there was a solution for three items...

So I wrote a little Python program to check. I found a three-item solution with an exact sum total, but the product total was off by 0.02 cents (0.0002 dollars). By allowing the items to be priced to the tenth of a cent, I got an exact solution.

Can you find the two three-item solutions? You'll need some sort of calculating device, unless you're a much better mathematician than I am.
__________________
Reply With Quote
Thanks, from:
Ensign Steve (08-29-2024)
  #2  
Old 08-29-2024, 05:16 PM
LarsMac's Avatar
LarsMac LarsMac is offline
Pontificating Old Fart
 
Join Date: Nov 2012
Location: On the Road again
Gender: Male
Posts: MMMDCCCXXXIX
Default Re: 7-11 puzzle

what about Sales Tax?
__________________
“Logic is a defined process for going wrong with Confidence and certainty.” —CF Kettering
Reply With Quote
  #3  
Old 08-29-2024, 06:11 PM
Ensign Steve's Avatar
Ensign Steve Ensign Steve is offline
California Sober
 
Join Date: Jul 2004
Location: Silicon Valley
Gender: Bender
Posts: XXXMMCCCXLV
Images: 66
Default Re: 7-11 puzzle

I think that's a US only thing, to add the tax at the register instead of having it included in the list price.
__________________
:kiwf::smurf:
Reply With Quote
Thanks, from:
mickthinks (08-31-2024)
  #4  
Old 08-29-2024, 06:49 PM
Ensign Steve's Avatar
Ensign Steve Ensign Steve is offline
California Sober
 
Join Date: Jul 2004
Location: Silicon Valley
Gender: Bender
Posts: XXXMMCCCXLV
Images: 66
Default Re: 7-11 puzzle

Quote:
Originally Posted by ceptimus View Post
What were the prices of the four items?

How do you actually solve it, though? I'm great a maths and at puzzles, but not always great at maths puzzles. :confused:

This is as far as I got:



:shrug:

I did google for "sum equals product" but I didn't want to dive too deeply in case I found a spoiler for this specific puzzle. Most of the results I saw had to do with integer solutions anyway, though. (I guess if you scale the problem by 100, we are in the integer space, at least for the 4-item solution)
__________________
:kiwf::smurf:
Reply With Quote
Thanks, from:
ceptimus (08-29-2024)
  #5  
Old 08-29-2024, 06:57 PM
Ensign Steve's Avatar
Ensign Steve Ensign Steve is offline
California Sober
 
Join Date: Jul 2004
Location: Silicon Valley
Gender: Bender
Posts: XXXMMCCCXLV
Images: 66
Default Re: 7-11 puzzle

I also spent some time mucking about with substitution, to reduce the number of variables. Maybe I'll try that tack again.
__________________
:kiwf::smurf:
Reply With Quote
  #6  
Old 08-29-2024, 07:21 PM
Ensign Steve's Avatar
Ensign Steve Ensign Steve is offline
California Sober
 
Join Date: Jul 2004
Location: Silicon Valley
Gender: Bender
Posts: XXXMMCCCXLV
Images: 66
Default Re: 7-11 puzzle



:derp:
__________________
:kiwf::smurf:
Reply With Quote
Thanks, from:
JoeP (08-30-2024)
  #7  
Old 08-29-2024, 08:54 PM
Ensign Steve's Avatar
Ensign Steve Ensign Steve is offline
California Sober
 
Join Date: Jul 2004
Location: Silicon Valley
Gender: Bender
Posts: XXXMMCCCXLV
Images: 66
Default Re: 7-11 puzzle

:dunce:


:lol: I fucking give up. I'm having fun but I'm not sure I'm getting anywhere and I have actual work to do. boo!
__________________
:kiwf::smurf:
Reply With Quote
Thanks, from:
ceptimus (08-29-2024)
  #8  
Old 08-29-2024, 09:15 PM
ceptimus's Avatar
ceptimus ceptimus is offline
puzzler
 
Join Date: Aug 2004
Location: UK
Posts: XVMMMX
Images: 28
Default Re: 7-11 puzzle

You can't solve it using simultaneous equations, because there are fewer equations than unknowns. The search for integer solution(s) (.01 dollars for this puzzle) falls into an area known as Diophantine analysis. There are some good articles on that on Wikipedia and elsewhere.

I'm hopeless at algebra, and always make lots of mistakes, but I like programming, and this problem is small enough to be solved by a simple program in about ten lines of code - probably fewer if you sacrifice clarity for brevity.

My code is a recursive routine. It accepts a sum target, and a product target as parameters, plus the number of unknowns remaining and a start value. There is also a global increment valuč (0.01 for cents in this case). When there are only two unknowns remaining, it tries all the values from start up to sqrt(product_total) for a, calculates sum_total - a for b, and finds the a,b pair where a×b is closest to the product total. It returns the lowest pair and the lowest error. When the recursive routine has more than two unknowns, it runs a loop from start up to nth root of product_total for an item, and calls itself with one less unkown, computing the new sum and product targets by subtracting/dividing the chosen value. It uses the chosen value as the start value for the next level of recursion. The return value of the function is the lowest error found at that recursion level, and a list of the values that result in that error. So the routine just runs the loop, remembering the lowest values found, appends the chosen value to that lowest result list, and returns that up to the outer recursion level.

It quickly arrives at the solution(s) with the lowest error. It found the 'solution' with the 0.0002 dollar product error for the 7-11 three-item case, and by running it again with a step size of 0.001 dollars, it found the exact three-item solution.
__________________
Reply With Quote
Thanks, from:
Ensign Steve (08-30-2024)
  #9  
Old 08-30-2024, 07:52 AM
JoeP's Avatar
JoeP JoeP is offline
Solipsist
 
Join Date: Jul 2004
Location: Kolmannessa kerroksessa
Gender: Male
Images: 18
Default Re: 7-11 puzzle

The very slight simplification I can offer - I don't think you mentioned this cep - is on prime factors:

Given the prices a, b, c, d as positive (obviously) whole numbers of cents (or tenths of cents in the second case)

then a/100 * b/100 * c/100 * d/100 = 7.11
ie abcd = 711 000 000
so each of a,b,c,d are factors of 711000000, so they are products of its prime factors 2⁶·3˛·5⁶·79 which limits the number of combinations you need to consider (ironically, 7 and 11 cents are not possible).
And of course they are each less than 711 (7110 in the tenths case), so it's not too important if I've miscounted the powers of 10 there.
__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:   :finland:
Reply With Quote
Thanks, from:
ceptimus (08-30-2024), Ensign Steve (08-30-2024)
  #10  
Old 08-30-2024, 08:55 AM
JoeP's Avatar
JoeP JoeP is offline
Solipsist
 
Join Date: Jul 2004
Location: Kolmannessa kerroksessa
Gender: Male
Images: 18
Default Re: 7-11 puzzle

My code finds the 4-item solution in 0.1s ...

but I can't find the 3-item, tenth-of-a-cent solution.

Is the multiplication exact or is there any rounding?
__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:   :finland:
Reply With Quote
Thanks, from:
ceptimus (08-30-2024)
  #11  
Old 08-30-2024, 10:16 AM
ceptimus's Avatar
ceptimus ceptimus is offline
puzzler
 
Join Date: Aug 2004
Location: UK
Posts: XVMMMX
Images: 28
Default Re: 7-11 puzzle

I shouldn't have said 'exact solution' :guilty: There is a very slight error, of 0.000012 cents. My Python code was rounding the answers it printed to two decimal places beyond the the increment size, so I didn't see the error.

Here's my 'near-enough-for-accounting-purposes' "solution".


I suppose the obvious bonus problems are:

What resolution is needed for an exact 3-item solution? (May not be possible using just powers of 10, so I suppose third-of-a-cent and other odd fractions might be needed).

(Difficult) Are there any 7-item or 11-item solutions, and if so what resolution is necessary to achieve them.
__________________
Reply With Quote
Thanks, from:
JoeP (08-30-2024)
Reply

  Freethought Forum > The Amphitheater > The Colosseum


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

 

All times are GMT +1. The time now is 05:31 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Page generated in 0.27324 seconds with 15 queries