Freigeben über


Logic Puzzle: Buying donuts puzzle

I thought it would be fun to try something new here.  So I am going to present a logic puzzle and let people try to answer it.  I will post the solution in the future but I want to give people a chance to try to solve it.

So here is the first puzzle:

A baker sells donuts in boxes of 6, 9, and 20. What is the greatest number of donuts that it is impossible to buy?

Comments

  • Anonymous
    July 31, 2008
    The comment has been removed

  • Anonymous
    July 31, 2008
    Infinity? Or is that too easy an answer?

  • Anonymous
    July 31, 2008
    Nice, thinking thinking thinking...

  • Anonymous
    July 31, 2008
    The comment has been removed

  • Anonymous
    July 31, 2008
    43 Dim test As Integer = 0 Dim remainder As Integer Dim indivisible As New List(Of Integer) Do While test < 10000    test += 1    remainder = test    For i As Integer = 0 To Math.Floor(test / 6) remainder = remainder - i * 6 For j As Integer = 0 To Math.Floor(test / 9)    remainder = Math.Max(0, remainder - j * 9)    For k As Integer = 0 To Math.Floor(test / 20) remainder = Math.Max(0, remainder - k * 20) If remainder <> 0 OrElse test <> i * 6 + j * 9 + k * 20 Then    If Not indivisible.Contains(test) Then indivisible.Add(test) Else    If indivisible.Contains(test) Then indivisible.Remove(test)    Continue Do End If    Next Next    Next Loop MsgBox(indivisible.Max())

  • Anonymous
    July 31, 2008
    Answer: 43 Also impossible: 1, 2, 3, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 22, 23, 25, 28, 31, 34, 37

  • Anonymous
    July 31, 2008
    6x + 9y + 20z + 19 where x, y and z = ∞

  • Anonymous
    July 31, 2008
    An infinite amount of donuts is impossible to buy.

  • Anonymous
    July 31, 2008
    The comment has been removed

  • Anonymous
    July 31, 2008
    The grammar of that question is atrocious, so it is hard to tell the exact meaning of the question.  However, given the most likely meaning either there is no solution to that question or there is a typo in the question.  Any multiple of any of those numbers plus any other number is impossible to get if you are requiring a discrete set of full doughnut boxes.  There is no greatest number.  This is one of the worst kinds of puzzle question:  it's called 'guess what I'm thinking because I've left out a crucial piece of information and expect you to be psychic'.

  • Anonymous
    July 31, 2008
    The comment has been removed

  • Anonymous
    July 31, 2008
    aaahhhh... what? ".. the greatest number of donuts that it is impossible to buy?" That question doesn't make sense.

  • Anonymous
    July 31, 2008
    are there any other conditions ?

  • Anonymous
    July 31, 2008
    I have gotten a few questions about this.  Sorry for the wording of the puzzle.  Basically you just want to find the largest number of donuts that you cannot buy.  And no, the answer is not infinity.  There are no other rules or limitations.  I'll post the solution and the comments early next week.

  • Anonymous
    July 31, 2008
    115 am i right? PS: Sorry about double commenting.. it's just i do not get any confirmation if my comment went through or not. I am just being redirected to the home page....and i do not see my comment...

  • Anonymous
    July 31, 2008
    i got it too...nice one!!! it tempted me to write a program at first, but then i realised it was too easy to be worth the typing :)

  • Anonymous
    July 31, 2008
    Well, using longhand manual calculation, I got a value of 43 as the most you cannot buy. My list of the "Unobtainable" amounts is: 1,2,3,4,5,7,8,10,11,13,14,16,17,19,22,23,25,28,31,34,37,43 I'm probably wrong, but it's worth a try.

  • Anonymous
    August 01, 2008
    The answer is: "there is no donut".

  • Anonymous
    August 01, 2008
    The comment has been removed

  • Anonymous
    August 01, 2008
    20 is the greatest you can buy 21 is the greatest you cannot

  • Anonymous
    August 01, 2008
    Dude, there's no "right" answer, as long as the following number exists: donuts = 20a + 9b + 6*c + 1

  • Anonymous
    August 01, 2008
    The comment has been removed

  • Anonymous
    August 01, 2008
    It either depends upon a) who is buying them and the amount of cash/credit they have available, or b) how many donuts and at what price the baker is willing/able to sell them for. If the total funds available to spend is greater than the aggregated cost of the maximum number the baker can supply, then only 'b' is relevant, otherwise 'a'. If both a and b are relevant, the door is left open to other factors, such has time to deliver is greater than the lifetime of the person purchasing - but that would be silly to consider :)

  • Anonymous
    August 01, 2008
    The comment has been removed

  • Anonymous
    August 01, 2008
    The comment has been removed

  • Anonymous
    August 01, 2008
    You need to buy a quantity that can be factored by 6, 9, or 20.  Since primes have no factors you can not buy prime number of donuts.  There are already proofs to prove there exists an infinite number of primes (won't bother repeating one), therefore the answer in in fact infinity.  I don't know why you said it's not. Or is this one of those things where the answer has no math basis?  Kinda like, you are only able to buy as many as the baker can bake.

  • Anonymous
    August 01, 2008
    Answer: 43 Just by listing the possible answers, you find out that the first 6 sequential numbers you can produce are 44 to 49, those allow you to produce all possible numbers. For fun : 6, 9, 12, 15, 18, 20, 21, 24, 26, 27, 29, 30, 32, 33, 35, 36, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49... Didn't even have to fire Mathematica... ;) but thx for the puzzle. (yes, I doubled every letter in my email domain part)

  • Anonymous
    August 01, 2008
    My wife calculated the number 43. She showed 43 to be impossible and the 6 numbers after 43 to be "possible", by which one easily concludes that every larger number is possible (by adding a 6box to a proved one). I can post a detailed proof if requested

  • Anonymous
    August 02, 2008
    37, after that there is a sequence of 6 numbers that can be made, so by adding 6 to the numbers allows the remaining numbers to be made. Used BFI alogrithm (brute force and ignorance)

  • Anonymous
    August 02, 2008
    The answer is 5, you can purchase any number greater than that, it will just require purchasing a few extra donuts along with them.

  • Anonymous
    August 03, 2008
    ans: 43

  1. can buy any amount where n % 3 = 0 for n>=6 as: 9x0 + 6x1 = 6 9x1 + 6x0 = 9 9x0 + 6x2 = 12 9x1 + 6x1 = 15 9x0 + 6x3 = 18 ...
  2. similarly any amount where n % 3 = 2 for n>= 26 (26 % 3 = 2, and 26= 20+6)
  3. similarly any amount where n % 3 = 1 for n >= 46 (20x2 + 6) thus: as n % 3 = 0, 1, or 2 for all n, the answer is less than 46. 45 % 3 = 0 (thus from 1, buyable) 44 % 3 = 2 (thus from 2, buyable) 43 % 3 is not buyable lots missed from this logic for a full proof, but it's close enough.
  • Anonymous
    August 04, 2008
    Here is the answer to the question that was posted, here . There are a few ways to answer this, you can

  • Anonymous
    August 04, 2008
    If I where to guess 42. Which is the Answer to Life, the Universe, and Everything.

  • Anonymous
    August 04, 2008
    The answer is now posted at: http://blogs.msdn.com/tom/archive/2008/08/04/answer-login-puzzle-buying-donuts-puzzle.aspx

  • Anonymous
    August 11, 2008
    That was cool :-) Thanks for posting it Tom.

  • Anonymous
    June 16, 2009
    The comment has been removed