Logic Puzzle: Buying donuts puzzlehttp://blogs.msdn.com/b/tom/archive/2008/07/31/logic-puzzle-buying-donuts-puzzle.aspxI 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 firsten-USTelligent Evolution Platform Developer Build (Build: 5.6.50428.7875)re: Logic Puzzle: Buying donuts puzzlehttp://blogs.msdn.com/b/tom/archive/2008/07/31/logic-puzzle-buying-donuts-puzzle.aspx#9762640Tue, 16 Jun 2009 19:33:38 GMT91d46819-8472-40ad-a661-2c78acb4018c:9762640Neil<p>Hi, I found a website with logic puzles online. It's Crosswords-world.net, and this is the link to nonograms section <a href="<a rel="nofollow" target="_new"><a rel="nofollow" target="_new" href="http://crosswords-world.net/jap/">http://crosswords-world.net/jap/</a>">японские"><a rel="nofollow" target="_new" href="http://crosswords-world.net/jap/">http://crosswords-world.net/jap/</a>">японские</a> кроссворды</a> or this <a rel="nofollow" target="_new" href="http://crosswords-world.net/jap/">http://crosswords-world.net/jap/</a>. There are more interesting puzzles.</p><div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=9762640" width="1" height="1">re: Logic Puzzle: Buying donuts puzzlehttp://blogs.msdn.com/b/tom/archive/2008/07/31/logic-puzzle-buying-donuts-puzzle.aspx#8848489Mon, 11 Aug 2008 20:08:00 GMT91d46819-8472-40ad-a661-2c78acb4018c:8848489imRahulSoni<p>That was cool :-)</p>
<p>Thanks for posting it Tom.</p><div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8848489" width="1" height="1">re: Logic Puzzle: Buying donuts puzzlehttp://blogs.msdn.com/b/tom/archive/2008/07/31/logic-puzzle-buying-donuts-puzzle.aspx#8832076Mon, 04 Aug 2008 23:28:22 GMT91d46819-8472-40ad-a661-2c78acb4018c:8832076ASP.NET Debugging<p>The answer is now posted at:</p>
<p><a rel="nofollow" target="_new" href="http://blogs.msdn.com/tom/archive/2008/08/04/answer-login-puzzle-buying-donuts-puzzle.aspx">http://blogs.msdn.com/tom/archive/2008/08/04/answer-login-puzzle-buying-donuts-puzzle.aspx</a></p>
<div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8832076" width="1" height="1">re: Logic Puzzle: Buying donuts puzzlehttp://blogs.msdn.com/b/tom/archive/2008/07/31/logic-puzzle-buying-donuts-puzzle.aspx#8832048Mon, 04 Aug 2008 23:14:03 GMT91d46819-8472-40ad-a661-2c78acb4018c:8832048Douglas Adams<p>If I where to guess 42. Which is the Answer to Life, the Universe, and Everything.</p><div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8832048" width="1" height="1">ANSWER Login Puzzle: Buying donuts puzzlehttp://blogs.msdn.com/b/tom/archive/2008/07/31/logic-puzzle-buying-donuts-puzzle.aspx#8831599Mon, 04 Aug 2008 20:16:32 GMT91d46819-8472-40ad-a661-2c78acb4018c:8831599ASP.NET Debugging<p>Here is the answer to the question that was posted, here . There are a few ways to answer this, you can</p>
<img src="http://blogs.msdn.com/aggbug.aspx?PostID=8831599" width="1" height="1">re: Logic Puzzle: Buying donuts puzzlehttp://blogs.msdn.com/b/tom/archive/2008/07/31/logic-puzzle-buying-donuts-puzzle.aspx#8818500Sun, 03 Aug 2008 18:32:34 GMT91d46819-8472-40ad-a661-2c78acb4018c:8818500joshka<p>ans: 43</p>
<p>1. can buy any amount where n % 3 = 0 for n>=6</p>
<p>as:</p>
<p>9x0 + 6x1 = 6</p>
<p>9x1 + 6x0 = 9</p>
<p>9x0 + 6x2 = 12</p>
<p>9x1 + 6x1 = 15</p>
<p>9x0 + 6x3 = 18</p>
<p>...</p>
<p>2. similarly any amount where n % 3 = 2 for n>= 26</p>
<p>(26 % 3 = 2, and 26= 20+6)</p>
<p>3. similarly any amount where n % 3 = 1 for n >= 46 (20x2 + 6)</p>
<p>thus:</p>
<p>as n % 3 = 0, 1, or 2 for all n, the answer is less than 46.</p>
<p>45 % 3 = 0 (thus from 1, buyable)</p>
<p>44 % 3 = 2 (thus from 2, buyable)</p>
<p>43 % 3 is not buyable</p>
<p>lots missed from this logic for a full proof, but it's close enough.</p><div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8818500" width="1" height="1">re: Logic Puzzle: Buying donuts puzzlehttp://blogs.msdn.com/b/tom/archive/2008/07/31/logic-puzzle-buying-donuts-puzzle.aspx#8815280Sun, 03 Aug 2008 13:12:30 GMT91d46819-8472-40ad-a661-2c78acb4018c:8815280Hanan<p>The answer is 5, you can purchase any number greater than that, it will just require purchasing a few extra donuts along with them.</p><div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8815280" width="1" height="1">re: Logic Puzzle: Buying donuts puzzlehttp://blogs.msdn.com/b/tom/archive/2008/07/31/logic-puzzle-buying-donuts-puzzle.aspx#8810910Sun, 03 Aug 2008 05:29:02 GMT91d46819-8472-40ad-a661-2c78acb4018c:8810910Matthew Dennis<p>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.</p>
<p>Used BFI alogrithm (brute force and ignorance)</p><div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8810910" width="1" height="1">re: Logic Puzzle: Buying donuts puzzlehttp://blogs.msdn.com/b/tom/archive/2008/07/31/logic-puzzle-buying-donuts-puzzle.aspx#8802676Sat, 02 Aug 2008 01:28:10 GMT91d46819-8472-40ad-a661-2c78acb4018c:8802676Andrey Andreev<p>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</p><div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8802676" width="1" height="1">re: Logic Puzzle: Buying donuts puzzlehttp://blogs.msdn.com/b/tom/archive/2008/07/31/logic-puzzle-buying-donuts-puzzle.aspx#8802022Fri, 01 Aug 2008 23:42:54 GMT91d46819-8472-40ad-a661-2c78acb4018c:8802022Jean-Philippe Leconte<p>Answer: 43</p>
<p>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.</p>
<p>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...</p>
<p>Didn't even have to fire Mathematica... ;) but thx for the puzzle. (yes, I doubled every letter in my email domain part)</p><div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8802022" width="1" height="1">re: Logic Puzzle: Buying donuts puzzlehttp://blogs.msdn.com/b/tom/archive/2008/07/31/logic-puzzle-buying-donuts-puzzle.aspx#8801403Fri, 01 Aug 2008 21:50:41 GMT91d46819-8472-40ad-a661-2c78acb4018c:8801403James<p>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.</p>
<p>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.</p><div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8801403" width="1" height="1">re: Logic Puzzle: Buying donuts puzzlehttp://blogs.msdn.com/b/tom/archive/2008/07/31/logic-puzzle-buying-donuts-puzzle.aspx#8801166Fri, 01 Aug 2008 21:06:51 GMT91d46819-8472-40ad-a661-2c78acb4018c:8801166Stephen<p>Given the wording and trickiness of some logic puzzles, I'm going to go with zero donuts. </p>
<p>According to the rules, it didn't say that you had to have no 'remainder' or extras of donuts.</p>
<p>To get 1 donut, you buy any box and have some leftover donuts. To get 3525 donuts you buy 177 boxes of 20, leaving 15 extra donuts, etc.</p><div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8801166" width="1" height="1">re: Logic Puzzle: Buying donuts puzzlehttp://blogs.msdn.com/b/tom/archive/2008/07/31/logic-puzzle-buying-donuts-puzzle.aspx#8801157Fri, 01 Aug 2008 21:05:18 GMT91d46819-8472-40ad-a661-2c78acb4018c:8801157Dave<p>This is a really interesting question. I've been going over it in my head for most of the day but I haven't gotten very far. The problem needs to be approached in a way that will prove all values can be reached after a certain number. That number is the answer to the original question. Here's what I've eliminated so far:</p>
<p>Obviously to start, all multiples of 6, 9, and 20 can be reached at all times. After the target number of donuts >6, all multiples of 3 are able to be reached as well. Since obviously there is a number larger than 6 that can't be reached (7 for example), we can generalize it and say that all multiples of 3 can be reached.</p>
<p>So the answer isn't a multiple of 3, 6, 9, or 20. That's all I can come up with though.</p><div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8801157" width="1" height="1">re: Logic Puzzle: Buying donuts puzzlehttp://blogs.msdn.com/b/tom/archive/2008/07/31/logic-puzzle-buying-donuts-puzzle.aspx#8800044Fri, 01 Aug 2008 17:31:10 GMT91d46819-8472-40ad-a661-2c78acb4018c:8800044Andrew Tollervey<p>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 :)</p><div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8800044" width="1" height="1">re: Logic Puzzle: Buying donuts puzzlehttp://blogs.msdn.com/b/tom/archive/2008/07/31/logic-puzzle-buying-donuts-puzzle.aspx#8799932Fri, 01 Aug 2008 17:10:24 GMT91d46819-8472-40ad-a661-2c78acb4018c:8799932Jon<p>I'm sorry, but if there are no other rules or limitations. The answer *is* that there is no largest number. You can take any multiple combinations of boxes of donuts of 6, 9, or 20 and then simply add 1. There, you cannot buy that many because you need at least 5 more to make a full box. You can do that exercise an infinite number of times. I suspect either you aren't giving us the full question or the 'answer' you have is incorrect mathematically.</p><div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8799932" width="1" height="1">re: Logic Puzzle: Buying donuts puzzlehttp://blogs.msdn.com/b/tom/archive/2008/07/31/logic-puzzle-buying-donuts-puzzle.aspx#8799884Fri, 01 Aug 2008 17:01:24 GMT91d46819-8472-40ad-a661-2c78acb4018c:8799884ZagNut<p>Dude, there's no "right" answer, as long as the following number exists:</p>
<p>donuts = 20*a + 9*b + 6*c + 1</p><div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8799884" width="1" height="1">re: Logic Puzzle: Buying donuts puzzlehttp://blogs.msdn.com/b/tom/archive/2008/07/31/logic-puzzle-buying-donuts-puzzle.aspx#8799315Fri, 01 Aug 2008 15:23:22 GMT91d46819-8472-40ad-a661-2c78acb4018c:8799315Steve Webster<p>20 is the greatest you can buy</p>
<p>21 is the greatest you cannot</p><div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8799315" width="1" height="1">re: Logic Puzzle: Buying donuts puzzlehttp://blogs.msdn.com/b/tom/archive/2008/07/31/logic-puzzle-buying-donuts-puzzle.aspx#8799235Fri, 01 Aug 2008 15:10:18 GMT91d46819-8472-40ad-a661-2c78acb4018c:8799235Eduardo<p>How many boxes does of each category does the baker has? Can the baker make an unlimitted number of boxes? </p>
<p>On the other hand, is the purchase of the donuts done in one day? How much the baker can produce in one day?</p>
<p>My guess is that if infinity is not an option, then we ned to look for the limitations the baker has or by the number of boxes I can carry?</p>
<p>Am I close?</p><div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8799235" width="1" height="1">re: Logic Puzzle: Buying donuts puzzlehttp://blogs.msdn.com/b/tom/archive/2008/07/31/logic-puzzle-buying-donuts-puzzle.aspx#8799188Fri, 01 Aug 2008 15:01:49 GMT91d46819-8472-40ad-a661-2c78acb4018c:8799188Chris<p>The answer is: "there is no donut".</p><div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8799188" width="1" height="1">re: Logic Puzzle: Buying donuts puzzlehttp://blogs.msdn.com/b/tom/archive/2008/07/31/logic-puzzle-buying-donuts-puzzle.aspx#8797459Fri, 01 Aug 2008 08:42:37 GMT91d46819-8472-40ad-a661-2c78acb4018c:8797459Robert Johnston<p>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</p>
<p>I'm probably wrong, but it's worth a try.</p><div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8797459" width="1" height="1">re: Logic Puzzle: Buying donuts puzzlehttp://blogs.msdn.com/b/tom/archive/2008/07/31/logic-puzzle-buying-donuts-puzzle.aspx#8797322Fri, 01 Aug 2008 08:18:44 GMT91d46819-8472-40ad-a661-2c78acb4018c:8797322kris<p>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 :)</p><div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8797322" width="1" height="1">re: Logic Puzzle: Buying donuts puzzlehttp://blogs.msdn.com/b/tom/archive/2008/07/31/logic-puzzle-buying-donuts-puzzle.aspx#8796943Fri, 01 Aug 2008 07:08:49 GMT91d46819-8472-40ad-a661-2c78acb4018c:8796943George Ter-Saakov<p>115 am i right?</p>
<p>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...</p><div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8796943" width="1" height="1">re: Logic Puzzle: Buying donuts puzzlehttp://blogs.msdn.com/b/tom/archive/2008/07/31/logic-puzzle-buying-donuts-puzzle.aspx#8796821Fri, 01 Aug 2008 06:42:27 GMT91d46819-8472-40ad-a661-2c78acb4018c:8796821ASP.NET Debugging<p>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.</p>
<div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8796821" width="1" height="1">re: Logic Puzzle: Buying donuts puzzlehttp://blogs.msdn.com/b/tom/archive/2008/07/31/logic-puzzle-buying-donuts-puzzle.aspx#8795919Fri, 01 Aug 2008 03:19:32 GMT91d46819-8472-40ad-a661-2c78acb4018c:8795919Raaga<p>are there any other conditions ?</p><div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8795919" width="1" height="1">re: Logic Puzzle: Buying donuts puzzlehttp://blogs.msdn.com/b/tom/archive/2008/07/31/logic-puzzle-buying-donuts-puzzle.aspx#8795609Fri, 01 Aug 2008 01:49:17 GMT91d46819-8472-40ad-a661-2c78acb4018c:8795609smcASP.NET<p>aaahhhh... what? ".. the greatest number of donuts that it is impossible to buy?" That question doesn't make sense.</p><div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=8795609" width="1" height="1">