Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 Re: Puzzles and Games » 3 in 1 ( logic+math+programming puzzle): random number » 2020-01-27 23:25:50

gmn

To make it easier for those who would like to try Math or Programming problem, below is solution for Logic problem:


Below is pseudo code that returns random number based on desired N and dice sides D. It represent shorter version of more detailed steps explained in solution above. But is not solution to Programming problem, since this return actual random number, while solution to programming problem need to return average/expected rolls needed to get random  number.

#2 Puzzles and Games » 3 in 1 ( logic+math+programming puzzle): random number » 2020-01-26 11:33:46

gmn
Replies: 1

Generate random number 1..N , using D-sided dice

1) Logic problem:  How to generate single uniform random number 1..N using fair D-sided dice in optimal way ( so that lowest number of rolls are needed on average) ?

2) math problem:  How to calculate average needed rolls for any N and D ?  What would be specific value for (N=4,D=6) or (N=20,D=6) ?


3) programming problem:  Write function that will calculate averageRolls(N,D)=?  It should return exact value as calculated in #2, not simulated or approximate value.

Obviously correct solution to Math problem depends on first finding correct optimal solution to Logic problem, and correct solution to Program problem depends on previously solving both Logic and Math problem. I can post further hints if needed . Actual reason why I posted this problem is because I find Program solution interesting ( since it may need slightly non-standard approach to transforming Math solution into program ). And reason I posted in this forum, instead of "Coder's corner' for example, is because it starts with solving logic problem.

#3 Re: Puzzles and Games » Wrong answers for some puzzles on this site » 2020-01-26 06:45:17

gmn
bob bundy wrote:

You've got Bd = byy and Ba = byy.  I'm hoping you meant Ba = yyy.

Yes, you are correct, that was typo for Ba - I updated my post to fix that.

#4 Re: Puzzles and Games » Wrong answers for some puzzles on this site » 2020-01-24 01:07:20

gmn

hi bob,

I think that your modified version would work, and that it now has single solution:

It still holds true that Colin would be also able to tell what marbles and labels everyone else has, even before Diana  - but now it does not invalidate problem itself, since it is not in collision with what Colin actually did.

Interesting version of this problem would be one that starts the same, but when it comes to Colin it does not tell us what marbles he draw:
Colin took two marbles from his container and, even without looking at his label, he was able to whisper the color of his remaining marble.
Note that above line makes it different problem, with different solution and even different answer to "Can you also tell what color marbles the others had?" ... so I just mentioned it as interesting 'different' problem, but your version should be one to replace original problem.

#5 Re: Puzzles and Games » Wrong answers for some puzzles on this site » 2020-01-23 04:27:54

gmn

I mostly agree, but have some comments:

1) "Why did not Harry work out his last color?" is a good question, but I believe that different interpretations of problem do not leave room for easy answer. Listing your suggestions :
    1a) Perhaps his logical ability isn't as good as SALLY's ?   I already explained why this is not valid - if his logical ability was low, he could have stated "I don't know" after drawing YY, even if he had yyy/yyb on his label - which would then result in wrong answer by Sally anyway.
    1b) Maybe they do not announce their last marble color until all have finished draw/look/reason ? Also hardly valid - problem strongly imply that Tom announced his color before 'Richard' etc. But even if we accept that they all announce at same time ... then Sally would have to announce at same time with them, and would not know what to say ( she could not use info from their announcements to make her decision)
    1c) Order of announces is different, with Harry - Tom - Richard - Sally , instead of Tom-Richard-Harry-Sally ? This is also hardly valid -  problem text very strongly imply order ( it mention them in Tom-Richard-Harry-Sally order ). Although, if Harry was first, then maybe it could work, providing that single deductible solution exists. But in order to really fix 'invalidity' of current problem, change of text would be needed anyway ( to rearrange Harry as first mentioned )

2) "SALLY must have yyy as her label" : this is only partially correct  - it correspond to 'b' version of possible answer   ( Tom 3/2, Duck 2/1, Harry 0/3, Sally 1/0) from my previous post. But another possibility also exists ( 'a' version from my post with Tom 2/3, Duck 1/0, Harry 0/2, Sally 3/1  )
    2a) "RICHARD (huh!) draws BY and looks at his label.  He says he knows the third marble.  This can only be done if his label is bby or byy." - this is also partially correct, and reason for above issue :  RICHARD can know his third marble regardless of his label, if he hears Tom saying "yellow" for 3rd marble. In that case Tom has BBY, and Richard can only have BYY.  Thus option that you marked as 'would not work'  (in your finished answer ) could, in fact, work - I explained that line of reasoning in my 2a/3a parts of previous post.

3) one potential different interpretation of the problem that I did not deeply consider ( and that could *maybe* explain differences) is if they are not able to either see what marbles others draw, or hear what others announced.
    3a) It can not be both (since then Sally would not have any information to base her " I know without looking" reasoning .
    3b) if they do not see what two marbles others draw, but hear what others announce as color of last marble?
    3c) if they see what two marbles others draw, but do not hear what others announce ?
    3d) if they see what two marbles others draw, do not hear color that others announce but do hear if they announce (meaning they hear if other "deduced" , but not what color they deduced  ?


While it is possible that one of above 3a..d interpretations of problem could fix smaller issue about multiple solutions ( current answer only mentions one possible solution, but another one also exists ), my key point and main argument in initial post was that nothing short of different problem text can fix major issue :   
If Sally is able to deduce solution without any additional information , then whoever was just before her must have been able to do the same.

That statement is true for ANY possible problem of this type - regardless if our specific solutions above are correct or not, if there is only single or multiple solutions,  what exact colors were in boxes, etc ...  point is that whatever Sally is able to deduce, Harry must be able to deduce also.

#6 Puzzles and Games » Wrong answers for some puzzles on this site » 2020-01-21 05:32:44

gmn
Replies: 7

I recently found this site, and binge-solved some that looked interesting. In the process I found that few of official answers are either wrong or not entirely correct.

#1) Marble Mix Up puzzle
Official answer is that "Sally knew what she had because she knew what was left" but, since she did not look at her marbles or her label, Sally did not have any more information than person before her (Harry), so Harry should have been able to deduce exactly same answer.

For example,  we can mark B/L as "number of blue marbles in someones box" / "number of blue marbles on label" ( where 0<= B,L <=3 ), and it will uniquely identify situation at any box. Also, we can mark as M ( 0..2 ) number of blue marbles out of those two marbles they took out of their box.

It is easy to see that only way to "know" what is in their box, after taking M blues, is if label has either same number of blues L==M ( in which case B=M+1) , or if label has one more blue L==M+1, in which case B=M .  This is because box can never have LESS blues than what we took as M, so box is either B==M+0 or B==M+1.  And we can be sure which one only if label is also one of those two values (in which case box content is other value ). As an example, if we take two blues ('bb', M=2), we know box must be either 'bbb' (B=3) or 'bby' (B=2). If label shows 'bby' (L=2) , we know box is B=3 ; conversely if label shows 'bbb' L=3, we know that box must be 'bby' B=2. But more importantly, if label shows any other number , we can not be sure about box content. So if label is 'byy' (L=1) - we can not eliminate neither of two box possibilities (B==2 or B==3)

Assuming others can see what marbles those before them draw, and hear when others tell their last color, they will be able to deduce both B and L value of those players who "knew" before them ( if Tom took two blue marbles and said 'blue', Duck knows Toms B=3, but also knows his L=2 )
So, lets look at the puzzle.
1) Tom takes 'bb' M=2 , see his label L and "knows" B, meaning label must have been either 2 or 3 (L=2|3), and box is consequently either 3 or 2 (B= 3|2) .. in other words, Tom has 2/3 if he said 'yellow', or 3/2 if he said 'blue'
2) Duck takes 'by' M=1, see his label and "knows". He can know if his L=1|2 ( implying B=2|1), but hearing what color Tom announced can also help him:
    2a) if Tom said 'yellow', then Duck certainly have one blue, regardless of his label:  B_tom=2 -> B_duck <> 2 , and due to M_duck=1 -> B_duck=1   ( Duck has 1/?  and say 'yellow', Tom had 2/3 )
    2b) if Tom said "blue",  Duck can not ignore his label ( must have L=1|2 to know), but then it would limit his possible box to B=2 and his label to L=1 ( since if B_tom=3 -> L_tom=2 -> L_duck <>2 -> L_duck=1 (he knows only if L=1|2 ) -> B_duck=2  ( Duck has 2/1 and say 'blue', Tom had 3/2 )
3) Harry takes 'yy' M=0 ( so he can have  B=0|1 ) , see his label and does NOT know right away- that means his label is neither 0 nor 1 ( ie L_harry=2|3) , or he would know right away. BUT ... depending of what Tom and Duck said before him:
    3a) if Tom said 'yellow', Harry knows that Duck has 1/? , Tom had 2/3 -> Harry can't have B==1 (Duck has it) , nor L==3 (Tom has it) -> B_harry=0 and L_harry=2 (0/2). Further, only B=3 remains -> B_sally=3 ; only L=0|1 remain and  B_duck==1 -> L_duck=0 ->  L_sally=1  [ Duck 1/0, Harry 0/2 , Sally 3/1 ]
    3b) if Tom said 'blue', Harry knows Duck has 2/1, Tom had 3/2 -> L_harry=3 (since 2 is taken) -> he knows all labels so far (1,2,3) ->  L_sally=0 -> he also knows Sally's box has options B_sally=1|0, just like his ( since B=2&3 are taken with Tom and Harry) -> B_sally=1 ( since her label is L_sally==0) -> only remaining box value is 0 -> B_harry=0  [ Harry 0/3 , Sally 1/0 ]

Note that above allows more than one color distribution (B/L):
  a) Tom 2/3, Duck 1/0, Harry 0/2, Sally 3/1
  b) Tom 3/2, Duck 2/1, Harry 0/3, Sally 1/0

Above means not specifically that official answer is incorrect, but rather that :
- answer is incomplete, since it mention only "b" version from above where Tom said 'blue', but Tom could have said 'yellow' as well and both Harry/Sally would know
- problem itself is invalid, since it is not possible that Harry would not know ( Hurry must be able to deduce his last marble, regardless of what he see on his label )


Above mention about invalid problem would be true regardless of wording of this puzzle, or even regardless of validity of my solutions above. If we assume that all of them are capable of logical conclusions, and if Harry and Sally have same information, then Harry must be able to get to same conclusion as Sally. If Harry have MORE information (and he did have more, ie he saw his label which Sally did not), this holds even more. On the other hand, if we assume that Harry is incapable of logical thinking, then Sally could not rely on his "don't know" answer (he may had label 'yyy', marbles 'yy' .. and still fail to deduce that his box is 'yyb') - in which case Sally would make mistake if she announce that she has 'yyb', as official solution suggests. So, it is NOT possible for Harry not to know, and Sally (without any additional information that Harry did not have ) to know.

POTENTIAL FIX , so that Marbles problem is not invalid: 
... all parts at start remain same... and then Harry takes two yellow marbles and announce without even looking at his label " I now know what marbles everyone have".

This would force 'a' version of result from above, since in 'b' version both Harry and Sally could have B=0|1, but in 'a' version B=1 is taken by Duck, so Harry and Sally have 0|3, and 3 is impossible with M=0 ('yy') - so Harry would know he has B=0 and complete solution is as one in 'a' ( Tom 2 blues, Duck 1 blue, Harry 0 blues, Sally 3 blues ), while problem remains valid and we avoid illogical situation where Sally knows better than Harry (who had more info btw).


#2) Merry Go Round Puzzle
For this one, it is correct result, but incorrect multiple results are implied : "There must have been a multiple of 3 as well as 4 plus one children. So, the minimum number of children riding on this Merry-Go-Round could be thirteen."
In fact, only single result with 13 kids is possible:    x/3+3/4*x= number of kids = x+1  -> (*12) -> 4x+9x=12x+12 -> x=12 -> number of kids = x+1 = 13  ( single possible solution )
Other implied results that are "multiple of 3 as well as 4 plus one children", like 25 kids (x=24) are NOT valid answer, since 24/3+3/4*24=8+18=26 <> 25 !



*EDIT* This forum should not be so picky about name D*I*C*K  (which they changed everywhere with 'math') - after all, they choose to use that name in the puzzle.  I tried now to change back all 'math' to 'D-u-c-k', but if forum change that also ... just consider that wherever you see 'Duck' or out-of-place 'math',  it actually means D*i*c*k ( as name of second person from Marble puzzle ) .

Board footer

Powered by FluxBB