# Glaring mathematical error in \_The Sentinel\_ by Lee and Andrew Child

**URL:** <https://boards.straightdope.com/t/glaring-mathematical-error-in-the-sentinel-by-lee-and-andrew-child/940652>\
**Category:** Cafe Society\
**Tags:** books-writing-myths\
**Created:** [April 24, 2021, 12:06am UTC](https://boards.straightdope.com/t/glaring-mathematical-error-in-the-sentinel-by-lee-and-andrew-child/940652 "2021-04-24T00:06:08Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![DPRK](https://avatars.discourse-cdn.com/v4/letter/d/4491bb/32.png) [@DPRK](https://boards.straightdope.com/u/DPRK)\
**Post date:** [April 24, 2021, 12:06am UTC](https://boards.straightdope.com/t/glaring-mathematical-error-in-the-sentinel-by-lee-and-andrew-child/940652/1 "2021-04-24T00:06:08Z")

</div>

The clock is ticking, and Jack Reacher has to get into the bad guy’s house. There is a big, strong iron gate and a numeric keypad to open it. Reacher knows the access code is four digits long, and there are therefore “ten thousand permutations”. So far, so good. He blows some dirt onto the keypad, revealing smudges on the zero, the two, and the four. Now there are eighty-one permutations…

…what? Since all three digits occur in the combination, there are obviously only thirty-six possibilities. Something Reacher, who spends an inordinate amount of time thinking about mathematical puzzles and is a bit of prodigy, would know immediately.

The theme here is, failure to double-check facts that your fictional character would certainly know.

---

<div class="post-metadata">

**Author:** ![don\_t\_ask](https://avatars.discourse-cdn.com/v4/letter/d/e68b1a/32.png) [@don\_t\_ask](https://boards.straightdope.com/u/don_t_ask)\
**Post date:** [April 24, 2021, 12:11am UTC](https://boards.straightdope.com/t/glaring-mathematical-error-in-the-sentinel-by-lee-and-andrew-child/940652/2 "2021-04-24T00:11:28Z")

</div>

There are 81 combinations. 3 x 3 x 3 x 3.

---

<div class="post-metadata">

**Author:** ![DPRK](https://avatars.discourse-cdn.com/v4/letter/d/4491bb/32.png) [@DPRK](https://boards.straightdope.com/u/DPRK)\
**Post date:** [April 24, 2021, 12:28am UTC](https://boards.straightdope.com/t/glaring-mathematical-error-in-the-sentinel-by-lee-and-andrew-child/940652/3 "2021-04-24T00:28:26Z")

</div>

Surely not. If the combination were “0000”, why would three of the keys have dust on them, instead of just one?

---

<div class="post-metadata">

**Author:** ![CairoCarol](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/cairocarol/32/3825_2.png) [@CairoCarol](https://boards.straightdope.com/u/CairoCarol)\
**Post date:** [April 24, 2021, 12:38am UTC](https://boards.straightdope.com/t/glaring-mathematical-error-in-the-sentinel-by-lee-and-andrew-child/940652/4 "2021-04-24T00:38:41Z")

</div>

I’m with the OP. Yes, we need to make a few assumptions to arrive at 36 possibilities, but those assumptions seem consistent with the information presented. As follows:

The four-digit code contains the digits 0, 2, and 4.

Therefore, one digit appears twice.

Thus, the sets of possible numbers are:

0024  
0224  
0244

The repeat digits can appear in 6 positions:

0 0 x x  
0 x 0 x  
0 x x 0  
x 0 0 x  
x 0 x 0  
x x 0 0

Each of those 6 different configurations allows two ways the digits could be filled in. For example, the first one could be 0024 or 0042.

So, we have 3 times 6 times 2 possible codes, which is 36.

---

<div class="post-metadata">

**Author:** ![SCAdian](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/scadian/32/3292_2.png) [@SCAdian](https://boards.straightdope.com/u/SCAdian)\
**Post date:** [April 24, 2021, 12:41am UTC](https://boards.straightdope.com/t/glaring-mathematical-error-in-the-sentinel-by-lee-and-andrew-child/940652/5 "2021-04-24T00:41:34Z")

</div>

X024 0X24 02X4 024X  
X042 0X42 04X2 042X  
X204 2X04 20X4 204X  
X240 2X40 24X0 240X  
X402 4X02 40X2 402X  
X420 4X20 42X0 420X

= 24  
x3 = 72

---

<div class="post-metadata">

**Author:** ![The\_Other\_Waldo\_Pepper](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/the_other_waldo_pepper/32/12370_2.png) [@The\_Other\_Waldo\_Pepper](https://boards.straightdope.com/u/The_Other_Waldo_Pepper)\
**Post date:** [April 24, 2021, 12:43am UTC](https://boards.straightdope.com/t/glaring-mathematical-error-in-the-sentinel-by-lee-and-andrew-child/940652/6 "2021-04-24T00:43:44Z")

</div>

> [@SCAdian](#):
>
> X024 0X24 02X4 024X  
> X042 0X42 04X2 042X  
> X204 2X04 20X4 204X  
> X240 2X40 24X0 240X  
> X402 4X02 40X2 402X  
> X420 4X20 42X0 420X
> 
> = 24  
> x3 = 72

If X is 0, then your first two are the same, and your last two are the same, and so on.

---

<div class="post-metadata">

**Author:** ![Maserschmidt](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/maserschmidt/32/18829_2.png) [@Maserschmidt](https://boards.straightdope.com/u/Maserschmidt)\
**Post date:** [April 24, 2021, 12:45am UTC](https://boards.straightdope.com/t/glaring-mathematical-error-in-the-sentinel-by-lee-and-andrew-child/940652/7 "2021-04-24T00:45:14Z")

</div>

I also got 36, though via a more onerous path.

I started with 3x3x3x3 = 81, but wanted to subtract out sequences that didn’t include all three digits. We can do that by calculating the permutations of drawing 4 from 2 with replacement, so pairwise

(1,2) → 2x2x2x2 = 16  
(2,3) and (1,3) also = 16  
BUT  
three of the sequences are duplicated in those pairwise calculations (1111, 2222, and 3333 each show up twice in those permutations), so

81 - 48 + 3 = 36

Very much the long way around.

---

<div class="post-metadata">

**Author:** ![JohnT](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/johnt/32/15048_2.png) [@JohnT](https://boards.straightdope.com/u/JohnT)\
**Post date:** [April 24, 2021, 12:45am UTC](https://boards.straightdope.com/t/glaring-mathematical-error-in-the-sentinel-by-lee-and-andrew-child/940652/8 "2021-04-24T00:45:48Z")

</div>

(hugs)

_This_ is why I come here.

And the number of permutations is always 42. Thought this was settled?

---

<div class="post-metadata">

**Author:** ![Blunt](https://avatars.discourse-cdn.com/v4/letter/b/ccd318/32.png) [@Blunt](https://boards.straightdope.com/u/Blunt)\
**Post date:** [April 24, 2021, 1:00am UTC](https://boards.straightdope.com/t/glaring-mathematical-error-in-the-sentinel-by-lee-and-andrew-child/940652/9 "2021-04-24T01:00:52Z")

</div>

I used Excel to figure out my answer. Listed out all 81 possible permutations of 4 digits using 0, 2, or 4, then counted how many times each of the 3 options were used and then filtered out any that didn’t use each of the 3 options at least once. I also came up with 36 to agree with a few posters above.

---

<div class="post-metadata">

**Author:** ![Chronos](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/chronos/32/134_2.png) [@Chronos](https://boards.straightdope.com/u/Chronos)\
**Post date:** [April 24, 2021, 1:19am UTC](https://boards.straightdope.com/t/glaring-mathematical-error-in-the-sentinel-by-lee-and-andrew-child/940652/10 "2021-04-24T01:19:35Z")

</div>

Andy Weir made a very similar mistake in Artemis: Four-digit code, containing three distinct digits. Except that he (or she; it’s first-person from the female protagonist) calculated it at 54.

And then, of course, figured out the single value for the code, based on what the three digits were and what she knew of the person who set it.

---

<div class="post-metadata">

**Author:** ![SCAdian](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/scadian/32/3292_2.png) [@SCAdian](https://boards.straightdope.com/u/SCAdian)\
**Post date:** [April 24, 2021, 2:06am UTC](https://boards.straightdope.com/t/glaring-mathematical-error-in-the-sentinel-by-lee-and-andrew-child/940652/11 "2021-04-24T02:06:13Z")

</div>

Okay – it’s 36.

---

<div class="post-metadata">

**Author:** ![DPRK](https://avatars.discourse-cdn.com/v4/letter/d/4491bb/32.png) [@DPRK](https://boards.straightdope.com/u/DPRK)\
**Post date:** [April 24, 2021, 2:21am UTC](https://boards.straightdope.com/t/glaring-mathematical-error-in-the-sentinel-by-lee-and-andrew-child/940652/12 "2021-04-24T02:21:27Z")

</div>

> [@Chronos](#):
>
> And then, of course, figured out the single value for the code, based on what the three digits were and what she knew of the person who set it.

It goes almost without saying that Reacher reasons what the code is on the first try:

> In Reacher’s experience people often used dates as code numbers. They’re easy to remember. And they often have some kind of sentimental significance. In which case the first digit would have to be zero. The second would have to be two or four. And the final pair could not both be zero. Now he was down to ten possibilities. Or possibly only one. Reacher remembered the black Mercedes…

---

<div class="post-metadata">

**Author:** ![bibliophage](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/bibliophage/32/7615_2.png) [@bibliophage](https://boards.straightdope.com/u/bibliophage)\
**Post date:** [April 24, 2021, 1:43pm UTC](https://boards.straightdope.com/t/glaring-mathematical-error-in-the-sentinel-by-lee-and-andrew-child/940652/13 "2021-04-24T13:43:53Z")

</div>

The correct number (36) is clear from the above posts, but in case anyone is interested in seeing a complete enumeration of possible solutions, I spent about 30 seconds writing a Python script to print them out. They are:

0 0 2 4  
0 0 4 2  
0 2 0 4  
0 2 2 4  
0 2 4 0  
0 2 4 2  
0 2 4 4  
0 4 0 2  
0 4 2 0  
0 4 2 2  
0 4 2 4  
0 4 4 2  
2 0 0 4  
2 0 2 4  
2 0 4 0  
2 0 4 2  
2 0 4 4  
2 2 0 4  
2 2 4 0  
2 4 0 0  
2 4 0 2  
2 4 0 4  
2 4 2 0  
2 4 4 0  
4 0 0 2  
4 0 2 0  
4 0 2 2  
4 0 2 4  
4 0 4 2  
4 2 0 0  
4 2 0 2  
4 2 0 4  
4 2 2 0  
4 2 4 0  
4 4 0 2  
4 4 2 0

---

<div class="post-metadata">

**Author:** ![digs](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/digs/32/14889_2.png) [@digs](https://boards.straightdope.com/u/digs)\
**Post date:** [April 24, 2021, 2:01pm UTC](https://boards.straightdope.com/t/glaring-mathematical-error-in-the-sentinel-by-lee-and-andrew-child/940652/14 "2021-04-24T14:01:33Z")

</div>

> [@DPRK](#):
>
> Now he was down to ten possibilities. Or possibly only one. Reacher remembered the black Mercedes…

Well, once you remember the black Mercedes…

…

I am seriously going to remember this thread the next time I write a scene involving numbers, and imagine you guys getting ready to critique my math:

> Reacher blew some dirt onto the keypad, revealing smudges on the zero, the two, and the four. Okay, now the possible permutations were… a lot easier.

---

<div class="post-metadata">

**Author:** ![BlankSlate](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/blankslate/32/80_2.png) [@BlankSlate](https://boards.straightdope.com/u/BlankSlate)\
**Post date:** [April 24, 2021, 2:09pm UTC](https://boards.straightdope.com/t/glaring-mathematical-error-in-the-sentinel-by-lee-and-andrew-child/940652/15 "2021-04-24T14:09:26Z")

</div>

Would blowing dirt on a keypad really reveal anything?

---

<div class="post-metadata">

**Author:** ![Bootb](https://avatars.discourse-cdn.com/v4/letter/b/e19b73/32.png) [@Bootb](https://boards.straightdope.com/u/Bootb)\
**Post date:** [April 24, 2021, 2:43pm UTC](https://boards.straightdope.com/t/glaring-mathematical-error-in-the-sentinel-by-lee-and-andrew-child/940652/16 "2021-04-24T14:43:23Z")

</div>

Potentially. Human skin contains oils, which could leave residue. I suppose it would depend on the type of material that the keypad buttons were made from, but that type of scenario is at least theoretically plausible.

---

<div class="post-metadata">

**Author:** ![Thudlow\_Boink](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/thudlow_boink/32/320_2.png) [@Thudlow\_Boink](https://boards.straightdope.com/u/Thudlow_Boink)\
**Post date:** [April 24, 2021, 4:27pm UTC](https://boards.straightdope.com/t/glaring-mathematical-error-in-the-sentinel-by-lee-and-andrew-child/940652/17 "2021-04-24T16:27:04Z")

</div>

> [@CairoCarol](#):
>
> The four-digit code contains the digits 0, 2, and 4.
> 
> Therefore, one digit appears twice.
> 
> Thus, the sets of possible numbers are:
> 
> 0024  
> 0224  
> 0244

That’s how I figured it, but from there, I used the fact that the number of permutations of _n_ objects, in which _k_ of them are identical, is _n_! / _k_!. Thus, 3 \* (4! / 2!) = 3 \* (24/2) = 36.

---

<div class="post-metadata">

**Author:** ![CairoCarol](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/cairocarol/32/3825_2.png) [@CairoCarol](https://boards.straightdope.com/u/CairoCarol)\
**Post date:** [April 24, 2021, 5:20pm UTC](https://boards.straightdope.com/t/glaring-mathematical-error-in-the-sentinel-by-lee-and-andrew-child/940652/18 "2021-04-24T17:20:32Z")

</div>

> [@Thudlow\_Boink](#):
>
> the number of permutations of _n_ objects, in which _k_ of them are identical, is _n_ ! / _k_ !.

That’s what I love about statistics - the formulae make perfect sense and can be derived by breaking problems down into small, logical chunks and then piecing together algorithms. I had to take graduate level statistics to get my master’s degree, and even though I was a bit slow to work my way through it all, I enjoyed learning, because it was such a pure exercise in logic.

Anyway, I have long since forgotten 95% of the formulae I was taught, so I couldn’t do it the way you did. But I still love statistics, even if the specifics I was taught are hazy now.
