Tuesday, 30 April 2013

Word Riddle - you love me or you hate me



With two I’m affirmative

With three I’m respectful
With four I’m more respectful
With all five I’m either loved or hated
But when I’m loved, I kill; and when I’m hated, I may save lives.




Answer



My guess is



siren




With two I'm affirmative



'si', which is Spanish for "yes".



With three I'm respectful



'sir', a respectful greeting.



With four I'm more respectful




'sire', a respectful title.



With all five I’m either loved or hated


But when I’m loved, I kill; and when I’m hated, I may save lives.



Sirens that were 'loved' led sailors to their deaths. Although they are an annoying noise, their sound means that help is on the way and lives may be saved.



seasonal - Putting up the lights


Feeling festive, you decide it's time to put up the lights. You dig out the box and plug a strand in. Uh oh, they are all the same color. This won't work, these are supposed to be multiple colors and broadcast your magnificence of exterior illumination skills! Now you have a hundred strands of 20 lights all the same blue color. Another glance in the box reveals a letter.



Hello future me! This is past you talking...or writing... Anyway, you know how we like puzzles? Well further-past you thought it would be funny to reset all the lights to the same color. I managed to figure it out with help from the manual and decided I should repay the favor. Unfortunately, that manual has been... misplaced. Here's what you need to know, though.


Each strand of 20 lights is wired like a 5x4 grid, and each bulb can be either blue, red, purple, or green. However, when you change the color of 1 bulb, the adjacent ones in the grid will cycle to the next color as well. The good news, though, is that this doesn't seem to wrap around. Good luck future me!




"I really hate you past me", you mutter to yourself as you examine the lights. You change the color of the 1st light and the 2nd and 6th lights also change to red. You change it again, and the same three become purple. Cycle again makes them green, and one last time brought them back to blue. Just to make sure, you cycle through the colors of the 7th light and notice the 2nd, 6th, 8th, and 12th lights follow suit.


"Alright, I can do this", you encourage yourself. You decide you want the lights to alternate the length of the strand (blue, red, purple, green, blue, ...) The problem is, you need a quick strategy to do this so you're not wasting all day doing it for your hundred strands. You grab a pen and paper to write down steps and get to work...



Answer



I believe it's



0 3 3 1 2
1 3 3 1 1
1 0 1 2 1
0 2 2 0 2




where the answer is expressed like this:


A B C D E
F G H I J
K L M N O
P Q R S T


where A represents the first light, B the second and so on. If a light X is pressed n times then the letter X is n. For example in my solution light 1 is pressed 0 times, light 2 is pressed 3 times, light 12 is not pressed, etc.



Background (Step 1):




So obviously this is a mod 4 question, as the cycles have length four. Furthermore pressing a button four times has no net effect. Also it does not matter which order the buttons are pressed in. Therefore we can reduce this down to an 4x5 array where each number is in the set [0,1,2,3].



Step 2:



Now the top row can be anything, but it fully dictates what the second row is. So we only need to bash out all the cases for the top row. Utilising a computer program (Python) I bashed out all the cases.



riddle - Throw me away. Who am I?




When you need me, you throw me away.

But when you’re done with me, you bring me back.



What am I?




This is not one of my riddles. If anyone knows who created this riddle, I would be delighted to hear it!



Answer



It could be



an anchor




because



an anchor's purpose is to hold a ship in place. To do that, it has to be dropped. When the ship is leaving, the anchor is pulled back up.



Monday, 29 April 2013

cipher - Dungeon Crawler: Level 3


You are the protagonist in a game designed by NeedAName Inc. Proceed through the levels using your video game knowledge to solve the puzzles therein. Solve all levels and beat the game!




Level 3: Cheat Codes


You enter the third room of the dungeon, and find a paper with what you recognize as hex cheat codes. The door to the exit of the room has a gameshark and a keypad awaiting a cheat code entry. The list of codes reads:



41207472
75652067
616d6572
206b6e6f

77732074
68652063
6f646520
746f2064
65636970
6865723a
42594150
50575a4c
53424144
46435251




Using the information hidden in the cheat codes, what is the cheat code that you enter to move on to the next level?


Previous Level



Answer



I would say



EE6B2800



Converting the hexcode to ascii gives:




A true gamer knows the code to decipher:BYAPPWZLSBADFCRQ



The code to decipher(Vigenere) the last part is the Konami Code (with two start buttons at the end. Only got this one after the tip in the comments. I only remember it with a single start button at the end while wikipedia doesn't say anything about a start button at all.):



BYAPPWZLSBADFCRQ : code[uuddlrlrbass] = hexmefourbillion



Converting to hexadecimal:



4,000,000,000 = EE6B2800 (base16)




I tried to do something with that last bit but putting it into an ascii converter again only leads to garbage.


mathematics - Chess tournament winning streaks


On lichess.org, they use a points system for keeping track of who is winning in a tournament. A win is worth two points, a draw is worth one point, and a loss worth zero points. Once a player has amassed two wins in a row, the following games will be worth double of what they are normally worth until there is a draw or a loss to break the winning streak. Furthermore, a player may "berserk" and cut their time in a game in half in order to add one extra tournament point with a win.


Here's an example: loss=0, win=2, win(berserked)=3, win=4, win(berserked)=5, win=4, drawbreaking the streak=2, draw(berserked)=1, loss=0, draw=1, represented as 0234542101, for a grand total of 22 tournament points. You can also find the official lichess explanation here.



To see if you understand, find a simple way to score 15 points in 4 games as a warm-up:



Win all four games, and berserk any three of them - for example, all but the first one, for a pattern of 2355.





Part One: (easy)


A player played 18 games, won two-thirds of them, and "berserked" half of them.


What is the minimum and maximum number of tournament points he could have received?




Part Two: (Hard)



How many ways are there to score seven points in seven games?


Note that permutations of a "way" are not additional "ways": 0202021 is the exact same solution as 0022012 or 2020201, but not the same solution as 3020200.



Answer



Part One.
The minimum is



27



To get the minimum




Make sure there are no winning streaks, and to berserk on as many losses as possible. Only 3 winning games will be berserked.
220220220230230230



The maximum is



60



To get the maximum:



Make sure to only have draws and no losses, berserk only on wins, also have the biggest winning streak you can, and - this is important - have at least one draw after the winning streak to increase that draw score by 1.

111112245555555552



Part Two.
The number of ways to score 7 points in 7 games is



10



Since permutations are not counted, then



we only need to find out the number of different scenarios to get 7 points. There are 15 ways to disassemble 7 into a sum of smaller integers. However, we cannot have a 4 or a 5, as that is only possible on a third consecutive win, and if there are three consecutive wins the total will be 8. So we are only left with 8 ways:

1111111
211111
22111
31111
2221
3211
322
331



The thing to notice here is




3 can only be achieved by berserking a win, and 1 can only be achieved by a draw. However, 2 is either a win or a draw after two consecutive wins. So the sequence 2221 can happen in two ways: either one draw and there wins - not in a row; or two wins in a row followed by a draw and another draw. Same thing with the sequence 322: three wins, or two wins in a row followed by a draw. So that brings the total number of ways to 8+2=10.



visual - Density-type puzzle: __________


I made another Density puzzle. This one is a bit simpler than my last one in that it has less steps, but at the same it feels a bit harder (though I can't judge that accurately as the creator). Here it is: enter image description here


Solution: (8,8)


Hint 1:



The background colors are not arbitrary, as @Jens so brilliantly realized. In fact, they are very specific.



Hint 2:




To solve the dots, remember that Morse code has very specific rules for its use.




Answer



Solution is:



Untitled document



First part:



Morse in dots, where one black dot means "dot", and three is "dash". Three white dots are separator - UNTITLED




Second part:



What Jens found was close. Colours in this order as RGB are:
222,10,112
2,202,110
11,111,201
Which is in base-3 letters: ZCNBTLDMS
With shift by one (or caesar cipher +1) it is: A DOCUMENT




Sunday, 28 April 2013

mechanical puzzles - Barrel - Part 2


An entry in Fortnightly Topic Challenge #35: Restricted Title 1. Title based on this xkcd.
This is a continuation of Barrel - Part 1, but this puzzle is still self-contained.
Continued in Barrel - Part 3, Barrel - Part 4, and Barrel - Part 5.





Oh no Carol, there'll be barrel peril! This time, it's a $6\times 6$ warehouse, and you need to get a "special" red barrel out of the warehouse through the only exit. (it's "special" because it's actually dynamite, hence the peril. You don't want your warehouse to blow up.) You must do this without letting any other barrels out of the warehouse. To review, a barrel takes up one cell when upright, and two cells when laid down. Maneuvering the barrels works as follows:



  • An upright barrel can be tipped over to lie flat.

  • A laid down barrel can either roll to its sides or be propped up.


Specifically, consider the following image.


enter image description here


The solid barrels in this example can move to any of their adjacent outlines, assuming those spaces are unoccupied by other barrels. A barrel cannot move past the wall, either.


Here is a diagram of the warehouse, with the exit shown by the missing wall in the top right. Please show how to get the red barrel (dynamite) out of the warehouse. You are not explicitly required to do this in the minimum number of moves, but it's quicker to present the answer if there are fewer moves, no? Please feel free to combine several moves into a single image with arrows and/or text explanation in order to shorten the answer.


enter image description here




Answer



Here's my attempt (maybe I'll get graphical when I have the time, text only for now.)


First, label the non-dynamite barrels like this:


enter image description here


and develop a notation: - means move the named barrel to the mentioned direction, by whichever means it can move there. (It will always be unique.)


Then, make the following moves:



1: D-up
2: E-up
3: K-up

4: L-up
5: J-right
6: N-up
7: N-up
8: Dynamite-up
9: Dynamite-up
10: J-left
11: K-down
12: L-Down
13: Dynamite-right

14: Dynamite-up
15: I-left
16: I-left
17: F-down
18: Dynamite-right
19: L-up
20: L-left
21: F-left
22: M-left
23: G-down

24: H-down
25: H-down
26: C-down
27: C-down
28: Dynamite-right
29: Dynamite-up
30: Dynamite-right

Not at all guaranteed to be the shortest way, and only mentally checked to work (please do double-check), but the Dynamite barrel never made any useless moves, and the other moves seemed pretty efficient too, so if there's a faster solution, it's not going to be very much faster.


EDIT: Chowzen created this brilliant animation:




enter image description here



Do check his comments below for more insanely helpful links :-)


EDIT 2: after staring at the animation for a while, this saves a move:


Omit move 16 entirely. Then, replace moves 19-21 with:



19: O-left
20: P-left
21: F-down


EDIT 3: looking for a shorter solution, I found a couple more 29s, and then this one with 26 moves:



1. D-up 11. K-down 21. Dynamite-right
2. E-up 12. L-down 22. Dynamite-right
3. K-up 13. I-left 23. Dynamite-right
4. L-up 14. I-up 24. Dynamite-up
5. J-right 15. M-left 25. Dynamite-up
6. N-up 16. G-down 26. Dynamite-right
7. N-up 17. H-down

8. Dynamite-up 18. H-down
9. Dynamite-up 19. C-down
10. J-left 20. C-down

Saturday, 27 April 2013

cipher - Moderators' communications leaked!


An online community has three moderators: Doorknob, Kevin, and Emrakul (in no particular order). In between making posts on meta, they decide to set up a code for their private communications, and start sending secret messages to one another. First Doorknob sends Emrakul this message:


$2211+1211=111+21+11+2111+1+1112+221+121=1221+2111+2122+2111+1=1112+1121=1211+121+2122+2122+2111+1222$


Then Emrakul sends this one to Kevin:


$1211+121+1121+221+121+1+2212+21+1211=1112=1121+21+1222=21=2212+2111+2=21+12+2212=21=1221+21+221$


Finally Kevin sends this to Doorknob, closing the circle:


$1112=2122+1112+2112+121=21+2121+2121+2122+121+1121=21+12+2212=2111+1+21+12+2+121+1121$


Can you decrypt the messages?



Answer




Yes.


Quite simply:



The ones and twos correspond to Morse code dots and dashes. The plus signs are letter separators, and the equals signs are word breaks.



That gives you



1. ZL SNIBEVGR PBYBE VF LRYYBJ
2. LRFGREQNL V FNJ N QBT NAQ N PNG
3. V YVXR NCCYRF NAQ BENATRF




Then all you need to do is



A 13-place Caesar shift (rot13)



To obtain:



1. MY FAVORITE COLOR IS YELLOW
2. YESTERDAY I SAW A DOG AND A CAT
3. I LIKE APPLES AND ORANGES




mathematics - The largest Monday number



A Monday number is a positive integer $N$ with the following three properties:



  • The decimal representation of $N$ does not contain the digit 0

  • The decimal representation of $N$ does not contain any digit twice

  • $N$ is divisible by every digit $D$ that occurs in its decimal representation


What is the largest Monday number?



Answer



Notice 9867312 is a Monday number.


The largest Monday number may not contain 5 because in this case it would end in 5, and thus not be divisible by 2, 4 and 8, so it would have at most 6 digits.



On the other hand, a Monday number may not have 8 digits. Indeed, if that were the case, the preceding paragrph would imply such a number has each digit but 0 and 5 in it. In particular, it would have the digit 3. But the sum of its digits would be 1 + 2 + 3 + 4 + 6 + 7 + 8 + 9 = 40, which is not divisible by 3.


It follows that the largest Monday number must have 7 digits. If it has the digits 9, 8 and 7 it must be a multiple of 504, and it's easy check the highest Monday number that is a multiple of 504 is 9867312. Because we know the largest Monday number has 7 digits, it follows that this is the largest such number.


mathematics - Aproximating 100 by 6


You're a fan of pen & paper RPGs and have finally arranged a new playing group, recruited amongst your friends from the mathematical faculty.


As a GameMaster (GM) you've assumed that all your players will be fully equipped with the necessary dice showing 4-sides (d4), 6-sides (d6), 8-sides (d8) 10-sides (d10), 12-sides (d12) and 20-sdies (d20). So your disappointment is great, when you show up for the game and all they have brought with them was a near-infinite amount of ordinary, six-sided dice.



While you luckily didn't need to have 'all' dice in your set, the RPG system you want to play with is based on d100 ( usually realized by using two d10 ), and you have to find a way of using (any number) of d6 and any rule you can think of, to realized a value range 0-99 (or 0 to 99).


One mathematician suggests:



We simply roll twenty of our d6, sum the rolls and subtract 20, that gives us the range (20;120)-20 = (0;100), and we consider both the 0 and the 100 to be 100.



This works, but chances for the various values are rather far from being an equal "fair" distribution, so soon the punch of players start a heated discussion on how they can 'best' achieve a fair distribution. They agree on the following metric:



"Ideally, each value has a chance of 0.01, so the best rule is the one which minimizes $\Sigma(( P_i - 0.01 )^2)$" - it does not matter how many (finite) rolls of d6 are used.



Under these conditions, what is the "fairest" method of getting to a range 0..99 (or 1..100) just using six-sided dice?





Notes:



  • I do not know a "best" solution for this (yet)

  • the 'algorithm' has to produce any value of the D100 range

  • The "fairest" algorithm wins. Only if two algorithms are equally fair, the one with less dice rolls wins.

  • the 'algorithm' can consist of any mathematical rule which you can think of, but it must be reasonably "doable" by a punch of mathematicians with nothing but pen & paper (and d6)

  • Any finite number of d6 ( or rolls thereof) may be used in the 'algorithm'


Note, that the last rule exclude all algorithms which do not guarantee that a result is reached in a finite number of rolls. (In particular, you can not re-roll until a certain value is rolled. You may reroll 1e106 times though.)




Answer



As xnor points out in his answer, this question is basically asking for the way to most evenly distribute $6^n$ results among $100$ bins, and gives a very brief description of the solution. I'll go into a bit more detail here. If you're not interested in the proofs, skip to section 2.3


Summary


In order to construct a "best" algorithm for converting rolls of one die into another, there are two types of optimality to consider:



  • Minimum "score." BmyGuest's metric: $$\sum_i ( p_i - 1/100 )^2$$ is basically the chi-squared statistic for goodness-of-fit, between the distribution resulting from the algorithm and a uniform distribution. I'll call the metric applied to a particular algorithm that algorithm's score.

  • Minimum number of rolls. I'll consider only the expected number of rolls for an algorithm.


Note I'll be diverging a from typical RPG terminology: when I refer to $\mathsf{3d6}$, for example, I mean that you should roll three six-sided dice without adding them, keeping track of the order the dice were rolled in (usually the dice are treated as indistinguishable from each other, i.e. rolled all at once). This is important because, as you noted, the results in a traditional roll are not equiprobable.


I also consider a $\mathsf{d}n$ to be numbered from $0$ to $n-1$, to make some of the math a little easier. If you're following my algorithms with real dice, just map $n\to 0$ for the input and vice-versa for the output.




In the general case, we want to map $m$ "results" into $n$ "bins." (In the original case, we have $m=6^k$, $n=100$.) Consider an algorithm that maps $r_i$ results to bin $i$.


The probability of landing in bin $i$ is $r_i/m$, so the score is:


$$ \sum_{i=0}^{n-1}\left(\frac{r_i}{m} - \frac{1}{n}\right)^2 $$


1.1 Distribution of an Optimal Algorithm


Since the score is a sum of independent terms we can easily isolate the effect of changing a pair of elements of the solution, $(r_i,r_j)$. Let's decrease $r_i$ by $1$ and increase $r_j$ by $1$, and see under what conditions the score decreases:


$$ \begin{align} \left(\frac{r_i}{m} - \frac{1}{n}\right)^2 + \left(\frac{r_j}{m} - \frac{1}{n}\right)^2 &> \left(\frac{r_i-1}{m} - \frac{1}{n}\right)^2 + \left(\frac{r_j+1}{m} - \frac{1}{n}\right)^2 \\ \frac{r_i^2 + r_j^2}{m^2} - 2\frac{r_i + r_j}{m n} + \frac{2}{n^2} &> \frac{r_i^2 + r_j^2 - 2(r_i - r_j) + 2}{m^2} - 2\frac{r_i + r_j}{m n} + \frac{2}{n^2} \\ 0 &> \frac{2}{m^2}(1 - r_i + r_j) \\ r_i &> 1 + r_j \end{align} $$


This means that if the solution contains two values which differ from each other by more than one, it cannot be optimal (since moving the two values closer together will decrease the score). Therefore, in an optimal solution $r_i$ will take on at most two values, separated from each other by $1$. Let's call them $r$ and $r+1$. Calling the number of bins with $r$ results $x$, and the number of bins with $r+1$ results $x'$, we can write a system of equations:


$$ n = x + x' \\ m = rx + (r+1)x' $$


We can solve for $x$ and $x'$ in terms of $r$:



$$ x' = n - x \\ m = rx + (r+1)(n-x) \\ m = rx + rn - rx + n - x \\ m = (r+1)n - x \\ x = (r+1)n-m $$


Given that $0\leq x \leq n$:


$$ 0 \leq (r+1)n-m \leq n \\ 0 \leq (r+1) - \frac{m}{n} \leq 1 \\ \frac{m}{n} \leq r+1 \leq \frac{m}{n} + 1 \\ \frac{m}{n} - 1 \leq r \leq \frac{m}{n} $$


Since $r$ must be an integer, we have:


$$ r = \left\lfloor \frac{m}{n} \right\rfloor $$


Substituting back in, we see that:


$$ \begin{align} r + 1 &= \left\lfloor \frac{m}{n} \right\rfloor + 1 \\ x &= \left(\left\lfloor \frac{m}{n} \right\rfloor +1 \right)n - m \\ x' &= m - \left\lfloor \frac{m}{n} \right\rfloor n \end{align} $$


1.2 Score of an Optimal Algorithm


The score of the optimal algorithm described above gives us a way to compute the minimum possible score for a given $m$ and $n$:


$$ \sum_{i=0}^{n-1}\left(\frac{r_i}{m} - \frac{1}{n}\right)^2 = x\left(\frac{r}{m}-\frac{1}{n}\right)^2+x'\left(\frac{r+1}{m}-\frac{1}{n}\right)^2 \\ = \left[\left(\left\lfloor \frac{m}{n} \right\rfloor +1 \right)n - m\right]\left(\frac{\lfloor m/n\rfloor}{m}-\frac{1}{n}\right)^2+\left[m - \left\lfloor \frac{m}{n} \right\rfloor n\right]\left(\frac{\lfloor m/n\rfloor + 1}{m}-\frac{1}{n}\right)^2 $$



To simplify this expression, we can make use of the identity:


$$ \left\lfloor \frac{m}{n} \right\rfloor = \frac{m}{n} - \frac{m\ \mathrm{mod}\ n}{n} $$


To prevent the equations from getting too long, I'll use $m' = m\ \mathrm{mod}\ n$:


$$ \left[\left(\frac{m-m'}{n} +1 \right)n - m\right]\left(\frac{m-m'}{mn}-\frac{1}{n}\right)^2+\left[m - \frac{m-m'}{n} n\right]\left(\frac{m-m'+n}{mn}-\frac{1}{n}\right)^2 \\ = (m-m' + n - m)\left(\frac{m-m' - m}{mn}\right)^2+(m - m+m')\left(\frac{m-m'+n-m}{mn}\right)^2 \\ = \frac{(n-m')(-m')^2+(m')(n-m')^2}{(mn)^2} \\ = \frac{(n-m')(m')}{(mn)^2}(m' + n-m') \\ = \frac{1}{n}\left(\frac{m'}{m}\right)\left(\frac{n-m'}{m}\right) $$


Thus we can see that the score decreases as $m$ increases, and has local minima when $m'$ or $n-m'$ are close to zero (i.e. $m$ close to divisible by $n$). This agrees with our intuition.


1.3 Optimal Scores for Mapping a $k\mathsf{d6}$ to a $\mathsf{d100}$


Using the expression above, Here's a table of the best possible scores for each $k \le 10$:


 k       m  (m mod n)  score
---------------------------
0 1 1 0.990

1 6 6 0.157
2 36 36 0.0178
3 216 16 2.88e-4
4 1,296 96 2.29e-6
5 7,776 76 3.02e-7
6 46,656 56 1.13e-8
7 279,936 36 2.94e-10
8 1,679,616 16 4.76e-12
9 10,077,696 96 3.78e-14
10 60,466,176 76 4.99e-15


An unstated assumption was that the assignment of results to bins was the same on each roll. Some algorithms achieve a better average score by allowing the results of one roll to influence the next. However, the score of each individual roll is limited by the same maximum.



An algorithm can have an expected number of rolls less than the maximum number of rolls, while maintaining the same score. In fact, an algorithm can have a finite expected number of rolls even with an infinite maximum number. This is possible when the algorithm allows "early termination."


An algorithm maps each input roll (previously "result") to a corresponding output (previously "bin"). If an algorithm maps all rolls beginning with a certain prefix sequence to the same output, once that prefix has been rolled we know the output will be the same regardless of the subsequent rolls and we can stop rolling.


Pay careful attention to the terminology in the following sections: a roll is the roll of a single die, and a sequence or input is a list of rolls input to an algorithm


2.1 Bounding the Expected Number of Rolls


In order to compute the minimum expected number of rolls, I make the assumption that each roll is made with the same type of die. That is, if the first roll is a $\mathsf{d6}$, all the subsequent rolls will also be $\mathsf{d6}$s. Essentially, instead of rolling a large number of different dice, we roll one die over and over. (Note this restriction means that we cannot analyze algorithms that use another source of randomness such as the orientation of the die.) Assume we are using a $\mathsf{d}b$.


The expected number of rolls is the sum, over all inputs, of the probability of each input times its length. If the length of sequence $i$ is $k_i$, then the expected number of rolls $E$ is:


$$ E = \sum_i k_i b^{-k_i} $$



Consider replacing a roll $\{x_1, x_2, x_3, \ldots, x_k\}$ with $b$ rolls all mapping to the same output as the original roll:


$$ \{x_1, x_2, x_3, \ldots, x_k, 0\} \\ \{x_1, x_2, x_3, \ldots, x_k, 1\} \\ \vdots \\ \{x_1, x_2, x_3, \ldots, x_k, b-1 \} $$


The algorithm is still valid, since all possible rolls are mapped to outputs, and the probability of each output is the same. The change in $E$ is:


$$ b\left[(k+1)b^{-(k+1)}\right]- k b^{-k} \\ = (k+1) b^{-k} - k b^{-k} \\ = b^{-k} $$


Thus, splitting an input increases $E$. Conversely, merging the set of inputs with a given prefix will decrease $E$. Therefore, choosing how many inputs of each length to assign to a given output can be solved by a greedy algorithm.


Imagine that the output space of the algorithm is represented by an interval of length $1$, and that each output is a sub-interval of length $p_i$ (the probability of that output). Each input is an interval of length $b^{-k}$, and the problem is to cover each output interval with a number of input intervals, with no overlap. The greedy algorithm does so optimally by repeatedly inserting the largest input (smallest $k$) that fits in the remaining space in the output.



Example: find the optimal distribution of inputs for $b=6$, $k=4$, $n=100$. We have:


$$ m = 1296 \\ \left\lfloor \frac{m}{n} \right\rfloor = 12 \\ m' = 96 $$


Remember that $p_i=r_i/m$, and $r_i=\lfloor m/n \rfloor + 0\text~{or}~1$, so:



$$ p = \frac{12}{1296}~\text{or}~\frac{13}{1296} $$


$6^{-1}=1/6$ and $6^{-2}=1/36$ are both too big, but $6^{-3}=1/216$ is small enough to fit in both $p_i$:


$$ \begin{align} p &= 2\times 6^{-3} + \frac{0}{1296} \\ &~\text{or}~2\times 6^{-3} + \frac{1}{1296} \end{align} $$


Finally, we fill up the remainder with multiples of $6^{-4}$:


$$ \begin{align} p &= 2\times 6^{-3} \\ &~\text{or}~2\times 6^{-3} + 1\times 6^{-4} \end{align} $$



We can see that this process is just the expression of $p$ as a decimal in base $b$! With this in mind, I'll skip an analysis of the minimum $E$ for optimally-scoring algorithms of finite $k$, and jump straight to algorithms where $k$ is infinite.


2.2 Optimal Algorithm with Exact Distribution


With an infinite maximum $k$, the value of $m$ is also infinite, and the score of the algorithm drops to zero. This means that we can achieve an exactly uniform output distribution. This allows us to forget about $m$, $m'$, $x$, and other values that complicated the analysis. $p=1/n$ for all the outputs. We can find the decimal expansion of $p$ by using long division to divide $n$ into $1$.




Example: $b=6$, $n=100=244_6$. The long division is done in base-6.


      .0020543...
__________
244 ) 1
.532
----
.024
.02152
------
.00204

.001504
-------
.000132
.0001220
--------
.0000100

The final row is a power of the base, signifying that the decimal expansion repeats. Note that if we round the expansion to four digits, we get the same result as in the example for $k=4$.


With the expansion in hand, we can write an expression for $E$:


$$ E = n\left[\sum_k d_k \times k \times b^{-k} \right] + (e+ k_r)\times b^{-k_r} \\ E = 100\left[2\times 3\times 6^{-3} + 5\times 5\times 6^{-5} + 4\times 6\times 6^{-6} + 3\times 7\times 6^{-7} \right] + (E+5)\times 6^{-5} \\ E = 14738/4665 \approx 3.159\ldots $$



The factor of $n$ appears because there are $n$ identical outputs contributing to $E$. $d_k$ is the $k$-th digit in the base-$b$ expansion of $1/n$, and $k_r$ is the number of repeating digits.



I don't know of a way to simplify the formula for $E$, since the decimal expansion can vary wildly with $b$ and $n$. For example, although $1/100=0.00\overline{20543}_6$ is a fairly short expansion, changing $n$ by $1$ results in $1/101=0.\overline{0020455351}_6$.


2.3 A Implementation of an Optimal Algorithm


Here I will describe one class of optimal algorithm, based on the interpretation of the input as a base-$b$ decimal such that the $k$-th roll is the $k$-th digit after the decimal point. For example, the input:


$$ \{0, 4, 2, 2, 3\} $$


(with $b=6$) is equivalent to the decimal:


$$ .04223_6 $$


Note that inputs are uniformly distributed over the interval $[0,1)$.


Unlike the previous section where we grouped the inputs together based on their output, here I'll group the inputs based on size. The total amount of the interval occupied by inputs of length $k$ is $n d_k b^{-k}$. Note that this quantity is equivalent to the amount that we subtracted from the remainder at step $k$ of the long division, for example:



      .0020543...
__________
244 ) 1
.532 <= 100 * 2 * 6^-3
----
.024
.02152 <= 100 * 5 * 6^-5
------
.00204
.001504 <= 100 * 4 * 6^-6

-------
.000132
.0001220 <= 100 * 3 * 6^-7
--------
.0000100

Thus, the remainder at each stage is simply the amount of the interval remaining after all the inputs of length $k$ or less have been removed. This leads us to the algorithm, which I'll demonstrate for $b=6$, $n=100$.



Setup: put the remainders from dividing $n$ into $1$ in base $b$ into a table, along with the number of new digits for each step.


             roll 3

.024 => 24 <--+
roll 2 |
.00204 => 204 |
roll 1 |
.000132 => 132 |
roll 1 |
.0000100 => 100 |
roll 1 --+

For every output you need, start at the top of the table. Alternate between two steps:




  • Roll the number of dice listed, and append their digits to the current value (which starts at zero).

  • If the current value is greater than the number on the current row, return the difference of the two $\mathrm{mod}\ n$; otherwise continue to the next row.

  • If you reach the end of the table, go back to the beginning, skipping the first row. (Note that if the decimal expansion terminates, the last remainder will be $0$ and you will never reach the end of the table.)



An example:




  • Start with a current value of $0$.


  • The first row is roll 3, so roll $\mathsf{3d6}$ and append their digits: $$ \{6, 1, 5\} \to 015_6 $$

  • The next row is 24. Since $15_6 < 24_6$, continue to the next row.

  • The next row is roll 2, so roll $\mathsf{2d6}$: $$ \{4, 6\} \to 1540_6 $$

  • The next row is 204. Since $1540_6 \geq 204_6$, return the difference between the two, $\text{mod}\ 100$: $$ 1540_6 - 204_6 = 1332_6 = 344 \to \boxed{44} $$



Side note: The probability that you have to repeat the table at least once is equal to the last remainder: $.00001_6=1/7776\approx 0.013\%$. Assume that the DM and your entire party of five (six people total) make one roll per minute, every minute, for the next 10 years. That's a total of around $3\cdot 10^{7}$ rolls. Therefore the number of times you'll loop through the table will be around $\log_{7776}3\cdot 10^{7} \approx 1.9$!


Thursday, 25 April 2013

riddle - What is the name of the board game? #3


This is a series of board game riddles, "Name the board game."
Previous riddle is here: What is the name of the board game? #2




From the given poem, name the board game.



Climb me, climb me, climb me fast.
Slide it up and slide it down.
Shoot it out and don't be last.
Climb and climb and slide around.




What is the name of the board game?



Answer



I'd say



Chutes and ladders. You try to get too the top the fastest and you can take shortcuts by going ladders(sliding up) and go back on snakes(sliding down)



Wednesday, 24 April 2013

knowledge - What world is he talking about?


" This is not easy to figure out", said Grandpa



" In this world,


403 = 308 and is same as 83"


I couldn't figure that one obviously.


" Here is a hint. 5 1 9 2" Grandpa spoke slowly.



What is he counting??



Answer




This counting with serious prompting from OP (perhaps Grandpa himself?) involves



an electronic display

enter image description here

then counting the segments lit-up by the spelled numbers:

403 = FOUR HUNDRED THREE = 4,6,5,6 (21) + 5,5,5,6,6,5,6 (38) + 3,5,6,5,5 (24) = 83
308 = THREE HUNDRED EIGHT is above as EIGHT is 5,2,6,5,3 = 21
so 403 = 308 and both use 83 segments.



The Hint: "5 1 9 2" Grandpa spoke slowly.



FONT (which is 7-seg here) used as clued by the initials "Five One Nine Two"




This method was also seen by Arnaud and OP deemed needed solving. (I hadn't got this.)




Second try: In this world, what is he counting? Well, Grandpa knows

Roman numerals, so he may be counting the number of different letters when written in this form. 403 = 308 and is same as 83
403 = CDIII → C,D,I
308 = CCCVIII → C,V,I
83 = LXXXIII → L,X,I
all using 3 different letters.




And "5 1 9 2" Grandpa spoke slowly, as he was counting the



and also 5 = V uses 1 letter, 9 = IX uses 2 different letters.





First non-standard try

Counting all (not-distinct) letters
403 = CCCCIII (usually 400 = CD, but rarely four C's is seen)
308 = CCCVIII

& 83 = LXXXIII, all having seven letters.



Tuesday, 23 April 2013

Riddle - Divided by a wall


I remember hearing this riddle when I was young.



Divided by a wall, N and S.
Tunnels in between, but no one pass.


The West has more, and the East has less.

Less is more, but More is less.


What am I, can you guess?



Hint 1:



I have a rectangular border





geometry - Aquaman's Revenge!


After you posted mean things online about Aquaman, he found out where you lived and kidnapped you (using his awesome aqua-powers), taking you to his super-secret aqua-lair. He has placed you in a room with a ceiling less than $10$ feet tall, a perfectly level floor, and, at the end of the room, a perfectly vertical wall with a mark exactly $5$ feet above floor level. There is a drain in the floor so that water drained into the room will not accumulate (at all). The room is otherwise featureless. Behind the marked wall is a reservoir of water. You have access to a compass (which can only draw circles around a given center), a plumb bob (which can only indicate a perfectly vertical line), and an awl (which can only poke holes through the wall). All the walls, ceiling, and floor are all opaque and you cannot see the reservoir. Notice that the tools given do not allow you to make any measurement.


Aquaman has challenged you



If you can drain the reservoir such that its water level is exactly $10$ feet above the floor, I will return you to your house and we can forget this ever happened. Otherwise, I will get a real superhero to come and deal with you - and you don't want that!



How can you use the three tools given to drain the reservoir and to know exactly when its water level is $10$ feet above the floor?



Answer



Set the compass to some size, less than the distance from the 5ft mark to the ceiling. Use the bob to find two points on the circle, one directly above the other. Then use the awl to punch holes at these points. Wait until the streams from both holes fall on the same spot. You're done! Plug the holes in a hurry and mock Aquaman some more.


Explanation: the velocity of a stream from a given hole will be $v=\sqrt{2gd}$ where d is the distance to the top of the water. The time to fall from a height h is given by $t=\sqrt{\frac{2h}{g}}$. This means that the horizontal distance traveled by a stream before fitting the ground will be $vt=2\sqrt{hd}$.



Given that $h+d=l$ where l is the height of water above the floor, the only time $h_1d_1=h_2d_2$ is when $h_1=d_2, h_2=d_1$, which means $l=h_1+h_2$. Because the holes are symmetric about the 5ft (height) line, $h_1+h_2=10ft, l=10ft$


story - Copycat Chess (Part 1/3)


This puzzle series is based on a chess story from the year 1934. It is also the first entry for the new fortnightly topic challenge.




Li Chai was known as the best chess player in all villages in the surrounding area. One day the Emperor himself got wind about his proficiency and invited him to play against his best chess players. It didn't take long for Li Chai to win, so the Emperor arranged a celebration for him.


Among the guests was the mandarin Kao Tse. He wasn't much of a chess player at all and wondered what's behind a game where both players control the same army. Therefore he challenged Li Chai to a game, where Li Chai would play white and the mandarin would copy all his moves.




How did Li Chai win the first game?





The rules:



  • standard chess rules apply, if not stated otherwise

  • you play white and your opponent copies all your moves (e.g 1. e4 would be followed by 1. ... e5)

  • you are allowed to make "stupid" moves, your opponent will copy all moves regardless how bad they are

  • you are not allowed to make moves which cannot be copied, of course except for the last move winning the game



To make this a little interesting, you must win in no more than 4 moves.



Answer




enter image description here

1. d4 d5 2. Qd3 Qd6 3. Qf5 Qf4 4. Q:c8#



Sunday, 21 April 2013

riddle - Guess Who Am I?




If you look you cannot see me. And if you see me you cannot see anything else. I can make anything you want happen, but later everything goes back to normal. Guess What am I?



Answer



Is it:




your fantasy?



You can make happen anything then, and are limited to what you see at that moment.


What is the most efficient method to solve a Rubik's cube?


I know there are several different standard methods to solve a Rubik's cube, some easier, some more straightforward. It is known that the minimum number of moves to guarantee a solution is 20. Which method comes closest to the theoretical minimum in fewest average moves from a randomized cube to a solution? What about worst case? Are there any potential methods that are more efficient but more difficult, but still within reason for a human to solve?




Saturday, 20 April 2013

riddle - When I'm called forth, times must be tough



I've got a puzzle for you to solve,


Like always, in three parts.


So start those engines, let those gears revolve


And let's let the puzzling start





My prefix is a common action


You might do it every day.


It's key to our communication,


Though if you can't, there's another way.


As seconds go by, the clock goes "tick!"


And the hands get farther apart


And the secret of my infix will finally click


When you find clock's action's second part.


My suffix is a friendly guy



He always says "hello"


While he drops out of Low Lunar Orbit


In which he'll frequently go.


As for my whole, that's a quite tragic tale.


One which we'll all someday know


When those who are there for you finally fail


Into my clutches you'll go.





What am I?




Answer



Just saw this puzzle bumped to the top. I'll give it a guess:


My prefix is a common action
You might do it every day.
It's key to our communication,
Though if you can't, there's another way.



Prefix: hear
Hear is a common action that we do every day to communicate. Some people can't hear but they can use sign language.




As seconds go by, the clock goes "tick!"
And the hands get farther apart
And the secret of my infix will finally click
When you find clock's action's second part.



Infix: tock
"Tock" is the clock action after "tick".



My suffix is a friendly guy
He always says "hello"

While he drops out of Low Lunar Orbit
In which he'll frequently go.



Suffix: he
The word "he" is repeated many times. Also "hello" minus LLO (drops out of Low Lunar Orbit) is "he".



As for my whole, that's a quite tragic tale.
One which we'll all someday know
When those who are there for you finally fail
Into my clutches you'll go.




Answer: heartache
Heartache is something tragic tales are all about, and which we'll all someday know. When people we count on let us down, we fall into heartache.

(We need to convert the infix tock to tac here, but the two sound similar).



Friday, 19 April 2013

mathematics - 9sums - a logical deduction puzzle


Each set of minuses contains an integer in the range [1,5]. The given numbers are the sum of the surrounding 4 numbers.




--- --- --- ---

13 14 11
--- --- --- ---
11 10 13
--- --- --- ---
11 9 14
--- --- --- ---

Can you solve the grid?



Answer






2 5 3 1
13 14 11
3 3 3 4
11 10 13
4 1 3 3
11 9 14
5 1 4 4

Wednesday, 17 April 2013

mathematics - How do you solve the circular table problem?


One classic puzzle has many different forms, but the basic strategy is the same.



Once upon a time there was a crazy king who had a very wise minister with him. The king had a habit of playing a strange game on a circular table.


The game was played as follows: The king told his minister a different number everyday - let's say he says 5. Then minister would then arrange five people and ask them to sit in a circular table with five chairs. Starting from a specific person, the king would then kill every second person on the table, until only one remained at the end, to which he would give 1,000 gold coins.


For example, if there were five people on the table, starting from person 1, he would kill person 2, person 4, person 1, and person 5 (skipping over persons 2 and 4 since they are already dead), leaving person 3 as the survivor and winner.


Now the wise minister was so clever as to calculate the winner beforehand as soon as king said the number, and asked his man to sit at particular seat so as to not be killed and also win some gold.


How did the minister decide the winner?





Answer



This is known as the Josephus problem. If the number of people $n$ is expressed as $n=2^m+p$, with $m$ as large as possible, the survivor is in seat $2p+1$ Another way to express it is to write $n$ in binary and rotate left one position. For example, let there be $19$ people at the table, so we write $19=2^4+3$ and the winner is $2\cdot 3+1=7$, or $19_{10}=10011_2$ Left rotating one space gives $00111_2=7_{10}$


story - Reconstructing A Chess Game #3 (fanmade)


I'm a huge fan of the first 2 parts made by @Evargalo, so i'll try too


My teacher once told me a strategy to defeat the enemy in the second turn.
I was so excited (:P) I forgot it. Can you help me?



Answer



The only known mate in 2 from the starting position is, as Black:



1. f3 (or f4) e5 (or e6) 2. g4 Qh4#




mathematics - A crawling spider and a cautious fly


Inside a rectangular room, measuring 16 feet in length and 8 feet in width and height, a spider resides at a corner. A fly buzzing in the room intends to land at a spot that will take the spider the longest to reach, knowing that the spider never drops or uses its web, but crawls at constant speed.


Where should the fly land?




Answer



The optimal distance seems to be



$\sqrt{14^2+18^2} = \sqrt{22^2+6^2} \approx 22.804$
which is greater than
$\sqrt{16^2+16^2} \approx 22.627$
If the fly stayed at the opposite corner.



Assuming the spider is on the roof corner, be in the opposite corner (on the floor), then move upwards 2 feet and sideways 2 feet.


The key to this puzzle is that there are 4 distances to be optimized.




Spider1 Spider2 Spider3 Spider4



Tuesday, 16 April 2013

visual - Physical puzzle in four parts


This is simple and has a glaringly clear solution.


Instructions:




  • Print

  • Cut

  • Assemble




To make it a proper puzzle and avoid half-solutions: The solution I'm looking for



  • has all pieces touching two others

  • produces an image people would generally considers not scrambled

  • is rotated with what appears to be the "ground" showing at the bottom


Get puzzling!




enter image description here




Answer



Someone had to do it.



enter image description here



I liked the ancient math one more though.


Saturday, 13 April 2013

lateral thinking - Michel's mysterious message


The following text-message exchange took place yesterday between me and my friend Michel:



M: Çorâ ârb fyk! Çî bwæ rœt nœ mæ þœśol? Ap kôx so śêm am śêmipat ø jûp? Aś wæ śadwol ap îp lakrœ am tœmb!
D: Is this one of your conlangs? Cuz if so you've got to send me the dictionary if you expect me to try to read it
M: Haha, no, the only dictionary you might need is an English one ;)
D: ...okay, can you send me a longer example please?



An hour or so later, he sent me the following by email:




Am o çâr am so dlîmb sil rañb o çegap. Mep o myþpu, bilpu, jip çâr, śarb jah su imbað oñ jilnað ymb om æðu þnir, mûl wip o blœ, gøl, þymbu çâr jah mêhaß am ap po þap bîm ûm ûl pæ up: ap jêð o çegap-çâr, ymb syp numð tênśolp.


Ap çyb o kilÅ›atop lîmb bûl rÅ“t o kûlpçâr, kømpab dlum, jah o vÅ“mu wirâ glyþ meg am su adðytop nabor. So bûl âkomb ûm pæ o pæg-vøkab çer rÅ“t o pêmor: o ñølu tênÅ›ilpogor pêmor jahîp þnât, jah kymorb jerð, omb Å›rûlð pÅ“rb imb telkapab, kloñœbab jah keravab følð, ymb rex im rex oñ kidð Å›ol çyx im tâx—so çegap jêð Å›emb oñ ñaðapolð. So pêmor jîmb ûm im ûm, dâaß śølru gop mep tjÅ“p iþpløp ampo so þœb oñ so çar—su çar, yð er so kukor Å›ol nimu nÅ“rð lîmb terb ap—ymb nimu rapor lîmb bûlð âkomb îp oñ ap, Å›ilþp ûm jêm þœb imb sim ûm omêsol. Mâ dâaß êkþpølð Å›ol so çegap: giblænð, gyhlænð, þirolð, kympluð (rex oñ suð), jûlblâgð (çu çyb çâr lænð bañâpab po trâsað), tafomð, bÅ“maß-lænð, er jol ûm so þøn Å›rûl, ymb ambub ûm so þøn kyþaz. So giþp lænð jol er ûm so riÅ›p-çymb þœb (dâaß am), Å›ol suð jol su âmru jêmð po çyñ jambâð, buk-þip lîmb jambâð rôtaß âñol çaþ delbom, im nibâð guwemb, þrâkaß bîm po so lañol.



I'm thinking it's got to be some sort of encryption, but not a straightforward one: there seem to be 38 distinct characters, for one thing. Can you help me decrypt it?



Answer



It's a phonemic substitution cipher, with these pairings (cipher character followed by phoneme):



k: p
g: b

p: t
b: d
t: k
d: g
Å›: f
ñ: v
h: θ
s: ð
þ: s
ð: z

v: ʃ
x: ts
f: tʃ
z: dÊ’
ç: h
n: m
m: n
ß: ŋ
r: l
l: r

j: w
w: j
o: É™
u: i
a: ɪ
i: É›
y: æ
e: É‘
ê: ʌ
û: ɔ

ô: ʊ
æ: u
ø: eɪ
œ: aɪ
â: oʊ
î: aʊ



The longer sample of text is from "The Hobbit", by Tolkien:



Am o çâ_r am so dlî_mb sil rañb o çegap

ɪn ə hoʊl ɪn ðə graʊnd ðɛr lɪvd ə hɑbɪt
In a hole in the ground there lived a hobbit. (...)



The original message is approximately:



Hello old chap! How d'you like my new cipher? It puts the fun in phonetic eh wot? If you figure it out reply in kind!



rhyme - A Humbled Response



Well, I may not be able to match the rhyme or meter ...or spelling ...or punctuation skills of other puzzle creators on this site, but I thought I should still at least have a go...



Well, I'm handing down the mantle- as that mountain dwarfs this ant hill
Though I.m honoured. lies he fed you. turning cheeks a rosy red colour.


As each time I tr& defeating, it.s my iwn end that I'm meeting.
He continles climbing spires. I.ll just wallow in these swamps.


But, this ain't just dactyl prattle - 'tis a rapping riddle battle
So, I'll play no second fiddle. to his better rhyming prose.


Yet I must admit I'm broken! -though his name here goes unspoken-
'Cos oith rsddles, what a dueler. He's the uedisputed champ!




What is/are the hidden message(s)?



Answer




Well, I may not be able to match the rhyme or meter ...or spelling ...or punctuation skills of other puzzle creators on this site, but I thought I should still at least have a go...



This tells us where to look: at the errors in rhyme/meter, spelling, and punctuation.




The first hidden message is given by




the spelling errors in the poem.



Bolding them up:



Well, I'm handing down the mantle- as that mountain dwarfs this ant hill
Though I.m honoured. lies he fed you. turning cheeks a rosy red colour.


As each time I tr & defeating, it.s my iwn end that I'm meeting.
He continles climbing spires. I.ll just wallow in these swamps.


But, this ain't just dactyl prattle - 'tis a rapping riddle battle
So, I'll play no second fiddle. to his better rhyming prose.



Yet I must admit I'm broken! -though his name here goes unspoken-
'Cos oith rsddles, what a dueler. He's the uedisputed champ!



So we have



the letters &ilose, which should actually be youwin,



and the message is



YOU WIN & I LOSE.






The second hidden message is given by

the punctuation errors in the poem the dots and dashes in the poem.



Marking them with stars:



Well, I'm handing down the mantle*-* as that mountain dwarfs this ant hill
Though I*.*m honoured*.* lies he fed you*.* turning cheeks a rosy red colour*.*



As each time I tr& defeating, it*.*s my iwn end that I'm meeting*.*
He continles climbing spires*.* I*.*ll just wallow in these swamps*.*


But, this ain't just dactyl prattle *-* 'tis a rapping riddle battle
So, I'll play no second fiddle*.* to his better rhyming prose*.*


Yet I must admit I'm broken! *-*though his name here goes unspoken*-*
'Cos oith rsddles, what a dueler*.* He's the uedisputed champ!



So the message seems to be



- .... .. ... - .. -- . or THIS TIME.






The third hidden message is given by

the rhyming 'errors' in the poem.



Bolding them up:



Well, I'm handing down the mantle- as that mountain dwarfs this ant hill
Though I.m honoured. lies he fed you. turning cheeks a rosy red colour.



As each time I tr& defeating, it.s my iwn end that I'm meeting.
He continles climbing spires. I.ll just wallow in these swamps.


But, this ain't just dactyl prattle - 'tis a rapping riddle battle
So, I'll play no second fiddle. to his better rhyming prose.


Yet I must admit I'm broken! -though his name here goes unspoken-
'Cos oith rsddles, what a dueler. He's the uedisputed champ!



So we have



the non-rhyming words "colour, swamps, prose, champ", which should be replaced by "hue, mires, riddle, ruler",




and the message is



HUGH MEYERS - RIDDLE RULER.





Putting it all together, we get a single unified final message:

Hugh Meyers, riddle ruler - you win & I lose ... this time.




Friday, 12 April 2013

enigmatic puzzle - Assassinate Shakespeare!


Factoid: The noun "assassination" first appeared in print in Shakespeare's Macbeth.


However, forget that. The puzzle is to reproduce the following ngram.


enter image description here


The correct answer will be a link to the Google ngram website. On following the link, the above graph will be reproduced exactly. Of course I have edited my version of the image to conceal the search term I used. On following your link, the text-box will be shown filled in, thus creating the graph. All other parameters are shown exactly as I submitted them.


Detail



enter image description here




Answer




Got it:



Kill Bill



I'm not sure much explanation is needed.



Just look at the title



mathematics - Trick-Or-Treat Probability Puzzle



On Halloween night, a young boy was trick-or-treating. It was late at night and he was on his last stop. He knocked at the door and said:




Trick-or-Treat!



The man inside said he had a bag of just 4 candy left. He said there were 1 hard candy, 1 gummy, and 2 lollipops.


He allows him to take 2 candy, and the boy does so. He grabs 2 from the bag without looking! He then states he has at least 1 lollipop, afterwards he asked his mom what the chances are of him having 2 lollipops.


His mom had no idea, but I bet you do! What were the chances of the boy pulling out 2 lollipops that night?



Answer



The answer is



1 in 5.




because given that he has at least 1 lollipop, the possibilities are:




  • 1 lollipop, 1 hard candy (probability 1 in 8)




  • 1 lollipop, 1 gummy (probability 1 in 8)





  • 2 lollipops (probability 1 in 16)




So the conditional probability of him having 2 lollipops is $\frac{1/16}{\frac{1}{8}+\frac{1}{8}+\frac{1}{16}}=\frac{1}{5}.$


At the OP's behest, I'm also explaining why it looks like the answer should be 1 in 3. (If anyone's not confused already, let's confuse 'em! :-) ) The boy has 1 lollipop; there are 3 possibilities for the other sweet, of which only 1 is 'the other lollipop'; so it looks like the answer should be 1 in 3. But we know nothing to distinguish the two lollipops. He has 1, yes, but which one did we choose? If the lollipops were one red and one yellow, and we knew he had the red one, then the answer would be 1 in 3. As it stands, however, the answer is 1 in 5 as proved above.


Thursday, 11 April 2013

visual - A treasure hunt for the magic artefact


Somewhere in a magical land a small golden chest is delivered by an white eagle to a soon-to-be heroine. She opens it with shaky hands, knowing what it means that this gift has been delivered to her. Indeed, the first thing which falls out is a parchment bound and sealed by her mentor. The letter reads:


The Letter


( Full Resolution Letter )


The chest also contains a map and 22 small scrolls, each listing a wisdom spell written by the mage in his runes.


The treasure map



( Full Resolution Map )




The 22 spell scrolls


( Full Resolution Spells )





The position can be found on the map. Use the following grid to specify the coordinates: Solution-Grid







  • This puzzle (in slightly different form) was 'solved' by an unintended short-cut (now closed), but is still requiring a 'proper' solution. You might find it by backward-solving it form the now known solution, but there is more fun in not doing so. (I hope.)


A hint:



- The lake and the compass both hold a clue...



A full eye-opener hint (strong spoiler!) added after the full solution has been posted:



The map overlaid with a hex grid (spoiler!)





Answer



I believe the full explanation is as follows...


We need to visit the 8 X marks around the map, but need to "end [our] trip in the dark forest" and avoid the witches tower, so we'll start on the lower left and proceed clockwise around the road.


Multiple hints point towards hexagonal tiling: The six pointed star, "honey, she still rules", seven minus one mages, the lake (looks like 4 hexes stacked), the compass on a 60 degree tilt, etc.


So if we draw a 60 degree grid over everything (using the lake as a guide for spacing), we get the following (I've labelled, in blue, all the features that appear in the spells in order from A to V):


grid and labels


You can now see that for each X we need to visit, there's a feature that has three copies that all triangulate on the given location. I've labelled these, in green, in the order in which we visit them.


Now, if we take these 8 spells in the order travelled, we end up with the following list (which is where Dennis Meng's solution picks up):


spells


From here, reading down the columns produces the text:




From the dead tree in the swamp, go South. Halfway to Mount Dragon, stop. Where you cross the road is the Holy Nut.



So, taking the dead tree in the swamp (assuming the swamp is indicated by the reed looking icons), we have roughly Ed (the lone P on my labelled map) and Mount Dragon (assuming it's the biggest, most foreboding mountain) at roughly Ak, you can see a clean "South" line based on the hex grid, which cuts the road at the bottom right of the Cg grid square, as indicated by the big yellow X on the labelled map. And so, here lies the Holy Nut!


riddle - Name that entity (2)


I answer all who can connect
I amend mistakes without respect


I aim to place, I aim to serve

I give you knowledge with little reserve


In me, the primary colours I do hold
Though two had a child who won't grow old



Answer



Are you:



Google



?


I answer all who can connect




Connect to the Internet



I amend mistakes without respect



Suggestions!



I aim to place, I aim to serve



A free service




I give you knowledge with little reserve



An essential source of knowledge these days.



In me, the primary colours I do hold



The logo is Blue, Red, Yellow (and Green) - NB: This refers to Subtractive Primary Colours (unlike those usually used in computer devices (Additive Colours))



Though two had a child who wont grow old




Green is a child of Blue and Yellow



logical deduction - Reverse Puzzling


George is a great puzzler, so I was extremely surprised when he didn't immediately know the answer to a really famous puzzle. It's a puzzle that you probably did years ago, and have heard so often you can do it from memory rather than working it out. It's also not really that difficult, so I was also surprised when it appeared to be stumping him.


"Come on, surely you know this one." I said.


"I don't. And don't call me Shirley." He answered grumpily. I could tell his mood was declining rapidly, but like any great puzzler he was down and not out, and I watched his facial expression change as he reached into his mental bag of tricks. He nodded towards a conveniently located white board. "Have you got a marker for that?"


I handed him one, and he drew up the following diagram:


Reverse FCB



He stepped back, admiring his work, beaming proudly. "Well, now the solution is very obvious!" he commented.


And indeed it was.


The question for you is:



what was the puzzle?




Answer



I don't know if the puzzle has an established name, but it should be something similar to this:



A man has to get a Fox, a Chicken, and a sack of Barley across a river.

He has a rowboat, and it can only carry him and one other thing.
If the fox and the chicken are left together, the fox will eat the chicken.
If the chicken and the barley are left together, the chicken will eat the barley.
How does the man do it?



.



All nodes in the graph represent all the LEGAL states in the puzzle (where nothing can eat anything else). Each line between each pair of nodes represents a single move (i.e. the man crossing the river).



.




F represents the Fox, C represents the Chicken, B represents the Barley, * represents the man, and | represents the river.



The puzzle starts at the top left node, and the goal state is at the bottom right node.



(On second thought, the reverse could be true as well, if the man starts on the right side of the river instead.)



Wednesday, 10 April 2013

cipher - Hidden message #1


One day I was visiting an unknown forest and I found some mysterious message written on the trees. The message was



WEZI SUZNKX JFWYM
QT BRX AMPP GLH



Help me to decode the hidden message.



Answer




@MOehm is right: the idea is:



go back with number of letters in the word itself



WEZI SUZNKX JFWYM



SAVE MOTHER EARTH



QT BRX AMPP GLH




OR YOU WILL DIE



visual - Thousands and thousands of words


This puzzle is part 25 of Gladys' journey across the globe. Each part can be solved independently. Nevertheless, if you are new to the series, feel free to start at the beginning: Introducing Gladys.






Dear Puzzling,


And so my journey has come to an end. This is my last destination. I have spent the day walking around in a shopping mall, trying to find the perfect souvenirs. I hope you have enjoyed my puzzles as much as I have enjoyed making them. I'll send you one more message once I get home to let you know the correct answers to my puzzles.


Wish you were here!

Love, Gladys.




Part 1



enter image description here



Part 2



1. The news put me in touch with strange gases (7)

2. Strike head of nail in long piece of tree (3)
3. Landlord engaged in toilet terrorism (6)
4. Venereal disease dropped from satellite to troublemaker (4)
5. Musician to almost guide make-up artist (9)
6. Fear to shoot rare ogre evenly (6)
7. Organize disorganized decoration (10)
8. Some gold estimated for first-born (6)



Part 3




1. A psychic; neither large nor small (6)
2. Solution with a high pH value (4)
3. Communication sent by post (6)
4. Slapping or walking musician (7)
5. JFK and MLK, for example (8)
6. New and original (5)
7. Enemy of the Allies (4)
8. The resolution of a legal dispute (10)






Gladys' journey will conclude in "More important than the destination".

Image credits: 4. Ixnayonthetimmay, CC BY-SA 3.0; 5.1 Steven Depolo, CC BY 2.0; 5.2 Rick Marshall, CC BY 2.0; 8.1 Allan warren, CC BY-SA 3.0; 8.2 Bruce Marlin, CC BY-SA 3.0



Answer



Complete Solution


Part 1:



1. laTEX + T = TEXT. (Thanks, @Omega Krypton!)
2. NAT King Cole + URAL mountains = NATURAL.
3. SCARLETT O'Hara - T = SCARLET.
4. VICI + centre of hOUSe = VICIOUS. (Thanks, @masterX244!)
5. VANILLA ICE CREAM - VANILLA ICE = CREAM.

6. First half of clownfish = CLOWN. (Thanks, @Omega Krypton!)
7. Vertigo - go + cal = VERTICAL.
8. Prince PHILIP + PINE = PHILIPPINE. (Thanks, @Omega Krypton!)



Part 2:



1. The news put me in touch with strange gases (7)
ME + gases rearranged SSAGE = MESSAGE (thanks, @JonMark Perry!)

2. Strike head of nail in long piece of tree (3)
LONG - head of nail N = LOG.

3. Landlord engaged in toilet terrorism (6)
toiLET TERrorism = LETTER (def. landlord).

4. Venereal disease dropped from satellite to troublemaker (4)

SPUTNIK - STI = PUNK.

5. Musician to almost guide make-up artist (9)
almost GUIde artist rearranged TARIST = GUITARIST.

6. Fear to shoot rare ogre evenly (6)
sHoOt RaRe OgRe evenly = HORROR.

7. Organize disorganized decoration (10)
rearrange decoration = COORDINATE (thanks, @Omega Krypton!)

8. Some gold estimated for first-born (6)
gOLD ESTimated = OLDEST.



Part 3:



1. A psychic; neither large nor small (6)
MEDIUM

2. Solution with a high pH value (4)

BASE (R.I.P. my chemistry skills haha....high is base and low is acid)

3. Communication sent by post (6)
LETTER

4. Slapping or walking musician (7)
slapping and walking are bass terms, so the musician is a BASSIST.

5. JFK or MLK, for example (8)
INITIALS (although I didn't see it, @JonMark Perry got this at the same time or before me. Thanks very much!!)

6. New and original (5)
NOVEL

7. Enemy of the Allies (4)
AXIS

8. The resolution of a legal dispute (10)
SETTLEMENT



Putting it all together:




1. TEXT MESSAGE MEDIUM = SMS.
2. NATURAL LOG BASE = E.
3. SCARLET LETTER LETTER = A.
4. VICIOUS PUNK BASSIST = SID.
5. CREAM GUITARIST INITIALS = EC.
6. CLOWN HORROR NOVEL = IT.
7. VERTICAL COORDINATE AXIS = Y.
8. OLDEST PHILIPPINE SETTLEMENT = CEBU.



Much gratitude to @athin for finding the final solution:




SM SEASIDE CITY CEBU in Cebu City, Philippines.



Tuesday, 9 April 2013

mathematics - Weighing in 89 different ways



On the table, there is a balance with two pans together with ten weights ofrespectively 1, 2, 4, 8, 16, 32, 64, 128, 256 and 512 grams. Cosmo takes a coin out of his pocket, shows it to Fredo and says: "There are exactly 89 different ways of placing the coin together with some (perhaps zero) of the weights into the left pan and placing some of the other weights into the right pan, so that the balance is in equilibrium."



Question: What is the weight of Cosmo's coin?




Answer



The weight of Cosmo's coin is



$341$, or represented as a binary number $101010101$.

Carl Löndahl found the second solution $171$.



Step 1




enter image description here

This image represents both sides of the scale, the colored part being the coin splitted in the corresponding weights. The part below demonstrates distribution of the weights for some possible weighings. In this case we only change the weights 256 and 512 ("bits" 8 and 9), and ignore changes in the rest of the bits. There are 2 possible cases. Let's call this number: $$S_1=2$$



Step 2



enter image description here

This time we look at the weights 128 and 64 ("bits" 6 and 7). We have again 2 possible cases. For each of the 2 cases we can choose 1 possible case from step 1 above which gives us together $2 * S_1$ cases.

enter image description here

But we have 1 additional case if we use all four "bits" 6 to 9. This gives us a new number: $$S_2=2*S_1+1=5$$



Step 3



enter image description here

Again 2 cases, this time using bits 4 and 5. Both can be combined with all cases from step 2.

enter image description here

One additional case using bits 4 to 7 which can be combined with all cases from step 1.

enter image description here

And one more case using bits 4 to 9. This gives us a total of: $$S_3=2*S_2+S_1+1=13$$




Step 4



enter image description here

Similar to previous chapters we can define: $$S_4=2*S_3+S_2+S_1+1=34$$



Step 5



I omitted the picture here as the pattern should be obvious now: $$S_5=2*S_4+S_3+S_2+S_1+1=89$$



Second solution (found by Carl Löndahl)




The nubmer of weighings can be calculated similarly for this number.

enter image description here
$$S_1=3$$
enter image description here

Here we see a difference, there are 2 cases without using bits 5 and 6, and this is also true for the following steps.$$S_2=2*S1+2=8$$ $$S_3=2*S_2+S_1+2=21$$ $$S_4=2*S_3+S_2+S_1+2=55$$ There is also a difference in the 5th step. Because bit 1 is already used we multiply with 1 instead of 2 here. $$S_5=1*S_4+S_3+S_2+S_1+2=89$$



General solution



Based on the thoughts above we can define a general way to calculate the number of weighings. First write the number in binary form. Then define a variable for each bit equal 1 from left to right as follows:

$x_1$ -> number of weights bigger or equal the value of the first set bit
$x_2$ -> number of remaining weights bigger or equal the value of the second set bit
$x_3$ -> number of remaining weights bigger or equal the value of the third set bit

...

The number can be then calculated as follows:
$$S_1 = x_1$$ $$S_2 = x_2*S_1+(x_1-1)$$ $$S_3 = x_3*S_2+(x_2-1)*S_1+(x_1-1)$$ $$S_4 = x_4*S_3+(x_3-1)*S_2+(x_2-1)*S_1+(x_1-1)$$ $$S_5 = x_5*S_4+(x_4-1)*S_3+(x_3-1)*S_2+(x_2-1)*S_1+(x_1-1)$$



logical deduction - Lots of ships in the battleship


We have enough amount of $2$x$2$ grid ships where you can put them on the $14$x$14$ grid battleship board. If this was a real battleship game, you could simply put $49$ of these $2$x$2$ grid ships into the board without any grid shared.



This time, you are going to put the ships one by one shown as the example below. Every time you put a ship, it cannot share more than 1 grid with other ships. That is, it must occupy at least three empty grids. In this case,



At most how many ships can you put into the board?



If this question was asked for $4$x$4$, the answer would be $5$ as shown below:


enter image description here


Here is the wrong way playing the game where you put the green ship, it shares two grid at the same time when you put it:


enter image description here



Answer



An obvious upper bound is




65, because each new ship after the first must occupy at least empty 3 squares, and $1 + \frac{196 - 4}{3} = 65$.



I couldn't do that well, however, so this might be suboptimal. My best arrangement so far gets to



64 ships:

enter image description here



Monday, 8 April 2013

visual - My Landmark Puzzle


After travelling around the world and returning home, I opened my passport to admire my stamps.


Five individual pieces of paper fell to the floor:


enter image description here


I must have picked them up somewhere, but I can't remember where...




Hint #1




All of these pieces have printing on one side only.



Hint #2



Some of the edges appear to be carefully torn.




Answer



Answer



You were in Giza, Egypt, at the Pyramid of Khafre?




Because



The four black and white pieces of papers seem to be parts of a QR code, but they appear skewed. However, if you stand them up along their hypotenuse edges and, using the black square as a base, lean them against one another so that the 4 corners come together to form a pyramid, the intent becomes apparent. When viewed from above, the code is now readable, and scanning it with a mobile device, we find it decodes to +2.

The shape implies that we should be looking at pyramids, and I guess that the last hint is either to imply there's more than 2 pyramids (but that would be better hinted by 2+), or, more likely that the precise location is the "2nd" pyramid, hence the Pyramid of Khafre, since it is known as "The Second Pyramid" and is the second-tallest and second-largest pyramid of Giza.



Saturday, 6 April 2013

mathematics - Multiple Choice Puzzle


What are the chances of getting this correct if you pick at random?




  1. 1/4

  2. 1/2

  3. 1/3

  4. 1/4


You are not allowed to add more answers to this list


Note; This DOES have a correct, demonstrable answer!



Answer



Probability of



picking `1/4` = `1/2`
picking `1/2` = `1/4`
picking `1/3` = `1/4`

Probability of


correct answer `1/4` = `1/3`
correct answer `1/2` = `1/3`
correct answer `1/3` = `1/3`

So the probability of me picking correct Answer is



( 1/2 * 1/3 ) + ( 1/4 * 1/3 ) + ( 1/4 * 1/3 ) = 1/3

Probability of me picking correct Label remains 1/4


Thursday, 4 April 2013

rebus - Anime guess Riddle #6



Like in my fifth part, I'm searching for the name of an anime. There is no knowledge about this anime needed to solve it, but it helps! I hope you have fun :)
This time I made a rebus riddle:
the riddle



Answer



I'm thinking the answer is



Sword Art Online

"abc combinations" are words so "S + word" = "Sword"
The thing in the top corner is a paint palette for "Art"
And the entire thing is balancing ON a LINE (of rope) for "Online"




I may be wrong about how I reached the second word, but I still think the answer's correct. Relatively simple, but I prefer this one over your others so far as it feels more puzzley. Keep up the good work! :)


lateral thinking - How did he know which rose to pick?



One day a wife picked a rose from a magical bush. Little did she know the rose bushed was cursed by a witch and who ever picks a rose from her bush gets turned into a rose and put on the bush. The only way she can get turned back is if her husband picks her as a rose, if he picks the wrong one though he gets turned into a rose also. But here is the thing, the wife has 3 kids and convinced the witch to let her be turned back into a human for the night to see her kids. The next morning he went to the Witch's rose bush and saw 20 roses. After looking at every rose he picks a rose and his wife appears in front of him.



How did he know which rose to pick?



Answer



He picked the rose which




didn't have dew on it.



Because



his wife had been allowed to be a human for the night, but all the real roses had been out overnight and gathered dew.



chess - Can White Castle?


This is the first chess puzzle I composed in the retrograde genre. I originally posted this in a chess dedicated forum. Hope you like it!


In the following position, is it possible that White could still castle?


enter image description here




  • To prove it's possible, all you have to do is provide a legal game.

  • If you believe it's impossible, you need to provide your reasoning.



Answer



Now that we have three increasingly complex proofs (two deleted, one of them mine) that it's impossible, it's pretty clear that it must be



possible after all!



Here's why:




1. b3 Nf6
2. Bb2 Ng4
3. Bf6 gxf6
4. Na3 Ne3
5. Nc4 Nxf1!
6. Ne5 fxe5
7. h4 Rg8
8. h5 Rg6
9. hxg6 Bh6
10. g7 Be3

11. g8=N Bc5
12. Nh6 Ba3
13. Nf5 Ng3
14. Nd4 exd4
15. Qb1 Bc1!
16. Qb2 Nh5
17. Qc3 dxc3
18. Rb1 Nf6
19. Rb2 cxb2
20. Nf3 b1=R

21. Nd4 Ra1
22. Nb5 Ng8
23. Na3 Bb2+
24. Nb1 Bg7
25. e3!! Bf8
26. O-O

In case you haven't already done so, you should totally check out @greenturtle3141's thorough answer (that unfortunately tripped up mere inches before the finish line) to see why the highlighted moves are absolutely essential.
Note that the notation has been edited to work with most PGN viewers, for instance https://chesstempo.com/pgn-viewer.html



This is, without doubt, the most refreshing chess problem I've ever tried to solve. Thanks, OP!


Understanding Stagnation point in pitot fluid

What is stagnation point in fluid mechanics. At the open end of the pitot tube the velocity of the fluid becomes zero.But that should result...