## Daily Mail Interview questions Article

The Daily Mail newspaper had an article yesterday about job interview questions. You can see the article on this link

I was skimming through the answers that were given at the end of the article until I got to question 12 where I could immediately see the answer given was incorrect. The question was as follows

### Number of Two’s Question

`If I write down all of the numbers from 1 to 1,000,000 on a page, how many times do I write down the digit 2?`

And the answer was given as follows

```111,111.
In the 100,000’s column you write 2 once
In the 10,000’s you write it down 10 times (because you need to get to 100,000 ten times to get to a million)
In the 1,000’s you write it down 100 times (ditto one level down)
In the 100’s you write it down 1,000 times
In the 10’s you write it down 10,000 times
And in the 1’s you write it down 100,000 times```

It only takes a moment’s thought to see that this is not correct. What they have done with this calculation is add up

• All the numbers from 200,000 to 299,999 = 100,000 numbers
• All the numbers from 20,000 to 29,999 = 10,000 numbers
• All the numbers from 2,000 to 2,999 = 1000 numbers
• All the numbers from 200 to 299 = 100 numbers
• All the numbers from 20 to 29 = 10 numbers
• And the number 2

This is clearly missing out a lot of numbers that contain the number 2. And there are lots of them, for example 12, 82, 124, 5292, 19245 etc etc. It also misses the point that several of the numbers that have been included in the calculation have the number 2 appearing more than once etc 227429, 29242 etc etc

I wasn’t too sure how to get the correct answer, so I did what I always do in this sort of circumstance (as you will well know if you have read my other articles). I wrote a short computer program to tell me the answer. Here it is

```#include <stdio.h>

int main (int argc, char **argv)
{
int loop = 0 ;
int loop2 = 0 ;
int twoFound = 0 ;
int twoNums = 0 ;
char buffer[256] = "" ;

for (loop=1; loop<=1000000;loop++)
{
sprintf (buffer, "%d", loop) ;
if (strstr (buffer, "2"))
twoNums++ ;

for (loop2=0;loop2<strlen(buffer);loop2++)
{
if (buffer[loop2] == '2')
twoFound++ ;
}
}
printf ("Number of 2's is %d\n", twoFound) ;
printf ("Number of numbers including a 2 is %d\n", twoNums) ;
}```

In the above program I am looking for the total number of two’s, and also the total number of numbers that include at least 1 two. The program gives the answers based on all numbers between 1 and the maximum number you provide as an input. Here are the results

``` pi@raspberrypi ~/ant \$ ./howmany 1000000
Number of 2's is 600000
Number of numbers including a 2 is 468559```

So in fact there are exactly 600,000 2’s in all numbers between 1 and a million. And apparently there are 468,559 numbers between 1 and a million that contain at least 1 two.

Out of interest the results for some other ranges are shown below.

```pi@raspberrypi ~/ant \$ ./howmany 100000
Number of 2's is 50000
Number of numbers including a 2 is 40951
pi@raspberrypi ~/ant \$ ./howmany 10000
Number of 2's is 4000
Number of numbers including a 2 is 3439
pi@raspberrypi ~/ant \$ ./howmany 1000
Number of 2's is 300
Number of numbers including a 2 is 271
pi@raspberrypi ~/ant \$ ./howmany 100
Number of 2's is 20
Number of numbers including a 2 is 19```

### Russian Roulette Question

I carried on reading the article and came to the question

'You play a game of Russian roulette with another person, is it better to go first or second?'

The answer provided by the Daily Mail was as follows

```Don't play it.

The answer, according to Plus Maths Magazine is that it's better to go first. Here's their explanation:

Let a be the chance that the person to shoot first wins the game and let b be the chance that the
person to shoot second does, so a+b=1.

Suppose that you go first.

The probability b that your opponent wins is equal to the probability p that he or she survives
your first shot times the probability q that he or she wins the game from then on, after having
survived the first shot.

Since 5 of the 6 chambers are empty and each has an equal chance of containing the bullet,
we get p=5/6. Once your opponent has survived the first round, he or she turns into the player to go
first, with probability a of winning the game, so q=a. This gives b=5/6a. Putting this together with
the fact that a+b=1 gives a=6/11 and b=5/11.

Hence you have a greater chance of winning if you take the first shot.```

Here is the definition of Russian Roulette from Wikipedia, which certainly agrees with my previous understanding of what it is all about.

```Russian roulette is a potentially lethal game of chance in which a "player" places a single
round in a revolver, spins the cylinder, places the muzzle against their head, and pulls the trigger.```

And yet both the Daily Mail and Plus Maths Magazine seem to have come to the conclusion that it is better to go first – which is extremely counter-intuitive since the first person to go has the first chance to blow their brains out.

In fact the answer is so counter-intuitive that I decided it must be wrong. And as you can guess, I wrote a program to check the answer.

There are 2 possible scenarios – 1 in which the magazine is spun in between each turn and another in which it is not. In the second version, someone is going to be a blood spattered mess on the floor after at most 6 turns

Anyway, I decided to investigate the probability of winning in both versions. Here is the program

```#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <math.h>
#include <unistd.h>

main (int argc, char **argv)
{
int firstShot = 0 ;
int secondShot = 0 ;

// init random seed
struct timeval tp ;
gettimeofday (&tp, NULL) ;

srandom (tp.tv_usec) ;

int maxNum = atoi (argv[1]) ;

printf ("With no spinning of magazine\n") ;

int loop = 0 ;
for (loop=1; loop<=maxNum;loop++)
{
int pos = random()%6 + 1 ;
if (pos%2)
firstShot++ ;
else
secondShot++;

}
printf ("First person shot %d times\n", firstShot) ;
printf ("Second person shot %d times\n", secondShot) ;

printf ("\nIf spinning the magazine\n") ;

firstShot = 0 ;
secondShot = 0 ;
int loop2 = 0 ;
for (loop=1; loop<=maxNum;loop++)
{
for (loop2=1; ;loop2++)
{
int pos = random()%6 + 1 ;
if (pos == 1)
{
if (loop2%2)
firstShot++ ;
else
secondShot++;
break ;
}
}
}

printf ("First person shot %d times\n", firstShot) ;
printf ("Second person shot %d times\n", secondShot) ;
}```

It uses random numbers so I ran a few times to get confirmed results

```pi@raspberrypi ~/ant \$ ./rroulette 1000000
With no spinning of magazine
First person shot 500184 times
Second person shot 499816 times

If spinning the magazine
First person shot 545229 times
Second person shot 454771 times

pi@raspberrypi ~/ant \$ ./rroulette 1000000
With no spinning of magazine
First person shot 499748 times
Second person shot 500252 times

If spinning the magazine
First person shot 545726 times
Second person shot 454274 times

pi@raspberrypi ~/ant \$ ./rroulette 1000000
With no spinning of magazine
First person shot 499715 times
Second person shot 500285 times

If spinning the magazine
First person shot 546036 times
Second person shot 453964 times```

What this shows quite unequivocally is that in the normal form of the game it is better to go second, and NOT first as the article is trying to suggest. The amount by which it is better to go second appears to be inline with the 6/11 amount in the answer provided

It also shows that in the form of the game where the magazine is not spun the chances are 50/50. This is as you might expect since there are 3 slots (slots 1,3 and 5) where the first person gets shot and 3 slots (2,4 and 6) where the second person gets shot

Having established that it is indeed better to go second, I had a closer look at the answer provided, and I can see the Plus Maths Magazine were answering a different question. The clue is in the following statement

“The probability b that your opponent wins is equal to the probability p that he or she survives your first shot times…”

These people are not playing Russian Roulette, they are taking it in turns to shoot at each other – and of course this immediately explains the reversed result

### Stop Press

Another day has passed, and the comments on this Daily Mail article are starting to build up. Many people have noticed the mistakes, but there is also a lot of rubbish being spouted.

Martin in Newmarket has spotted the problem with the 2’s question, but look at the response from Jack in Dallas.

```Martin, Newmarket, 16 hours ago
The answer given in the box to question 12 is surely wrong.
It says there would be just one "2" in the 100,000s column,
but there are 100,000 numbers between 200,000 and 299,999 so
that can't be right, can it? I think you would write the digit
"2" 600,000 times altogether.

Jack, Dallas TX, United States, 7 hours ago
Nope. It's correct. Seen it before.```

You may well have seen it before Jack, but why does that have to mean that what you have seen is correct? Since you have clearly not analysed the problem yourself, why be so dogmatic about it?

MacStryder in Sweden seems to be talking about the variation of Russian Roulette in which the barrel is not spun between turns, which as I have demonstrated results in an even chance of winning irrespective of whether you go first or second. MacStryder seems to have reached a different conclusion.

```MacStryder, umadtho, Sweden, 1 day ago
"Is it best to go first or second?" - First. Definitely. When you
consider the game is played with a six chamber pistol  usually, it
makes sense to go first as you have a 1 in 6 chance of dying. If, however,
you go second and the first player survives, you are left with a 1 in 5
chance of dying, the likelihood of you dying rises to 20%. God....I am so bored.```

```Completely Average, Somewhere, United States, 1 day ago
I'm amazed how many people get the Russian Roulette question wrong.
--------------- The question is would you rather go first or second.
------------ It's a logic problem.You must solve the question using
logic....Now, logic dictates that in order to go second the person
who goes first must survive, therefore the correct answer is always
to go first.```

Again the tone of this response by “Completely Average” is arrogant and dismissive . Stewski in Doncaster then makes a valid point

```stewski, Doncaster, United Kingdom, 1 day ago
Logic also tells you that the person who goes first doesn't
always survive.If the odds are 1 in 6 that he is killed with
a 6 shooter then the person who goes second only faces the threat
5 times out of 6 making it wiser to go second.```

And Completely Arrogant (as I like to think of him) responds as follows:

```Completely Average, Somewhere, United States, 1 day ago
You're wrong. Odds have NOTHING to do with the question.
The question is, is it better to go first OR SECOND? You must choose one.
Second is only possible if first survives. If first dies then there is
no second. ---------- The question is a logic puzzle to see how your mind works.
The point of the question is to see of you can logically deduce the correct
Russian Roulette logic puzzle. ---------- And congratulations, you failed.```

When Peter Brown of Bristol makes a similar point to stewski, Completely Arrogant responds with vitriol:

```Peter Brown, Bristol, United Kingdom, 1 day ago
The answer to the question whether to go first or second in Russian
roulette is: go second, there is always a chance that the other idiot
will blow his brains out with the first firing and thereby negating the
need to do it yourself.```
```Completely Average, Somewhere, United States, 1 day ago
You really are dumb. ----------- You think I'm wrong? --- Check Google.
Russian Roulette Logic Puzzle. Go ahead and look it up. -------------
And FYI, you FAILED.```

So I did google “Russian Roulette logic puzzle and there is a lot of stuff about this question and other related scenarios where there are more than one bullet in the barrel. But I couldn’t find the article that Completely Average was talking about.

I would venture to suggest that the “logic” that Completely Average is proposing is nonsense. But since he is trying to split hairs I will play him at his own game. Consider the following

• The assertion seems to be that a second turn is required to happen and that this means the first turn will result in the bullet not being discovered. Thus it necessarily means that the game has been rigged since quite clearly in a fair game the person going first has a 1/6 opportunity of blowing his brains out. This means that the game being played is not Russian Roulette and there is a logical inconsistency in the way the question is formed.
• I would also make the point that the statement “if first dies then there is no second” does not have to be true. There is nothing to stop the second player prising the blood-spattered gun from the hand of his dead opponent and taking his turn, however messy and unpleasant that may be (although completely safe). Granted it may result in an interesting conversation with the police afterwards…

So I’m sorry Completely Average – but you failed.