# The Pit and the Pentium

by Philip Newman

There are three things that you need to realize to solve this puzzle.

1. The computer works in a rather simple way. Each digit of the output represents the number of times that a digit occurs in the input. The first place gives the number of "0"s, the next gives the number of "1"s, etc.

2. You are told that both means of your death can not happen. You are also told that given an input x and its output y, x=poison implies y=pit, and vice versa. So how can you get out alive? You need a number that returns *itself*.

3. What is this number? Well, we need a 10 digit number such that the first digit is the number of "0"s in the number, etc.
Obviously we can only have 1 of the digits 5, 6, 7, 8, 9, or the digits would add up to more than 10 (the total number of digits must equal the sum of the digits). That means we have at least 4 of the digit 0.
Let's call the number of zeros we have x.

So our number is:
0123456789
x????--1--

The notation at the end means there is at most 1 of the last 5 digits. Since there is a 1, we must put a 1 in the ones place:
0123456789
x1???--1--

But wait, there's now 2 ones... so, let's put a 2 in the ones place and a 1 in the twos place:
0123456789
x21??--1--

We can't have any threes or fours, so we'll fill those in with zeros:
0123456789
x2100--1--

Now we know that x is 6, so to finish it off:
0123456789
6210001000

So, 6210001000 is our solution.
Are there any other solutions? Yes. If we can find a number that gives our solution as its output, it must also work, because if it sets off a trap, our solution would have to set off a trap. So, any number with 6 zeros, 2 ones, 1 two, and 1 six will work. Also any number that will produce any of those numbers will work, and so on.
What about numbers A, B, C such that A gives B, B gives C, and C gives A? Those would be solutions, if they existed. Can you find three numbers like this?