*Spoiler for New Scientist Enigma 1713: *

I am going to start with a number and repeatedly take inventories of the digits in it. For example, if I start with 1531, then I read this as “one 1, one 5, one 3, one 1”, which can be written as an inventory of 11151311. This new list has “three 1s, one 5, one 1, one 3, two 1s” and so has an inventory of 3115111321. This list, in turn, has an inventory of 1321

1531131211, and so on. Notice that in this last case, the original number appears as part of a subsequent inventory (as highlighted in bold).Find another four-figure number with the same property – one that appears as part of a subsequent inventory. Your original number must be a palindrome and its digits must add up to a two-figure number.

This is one of those problems I figured out how to solve after I solved it. That is, I ended up guessing a possibility that worked before I figured out how to reduce the possibilities to a very manageable number.

Consider four consecutive digits *wxyz* of an inventory, starting in an odd numbered place (1st digit, 3rd, 5th…). Then the preceding number contained *xx…xzz…z* with *x* occurring *w* times and *z* occurring *y* times. But the important thing is, *x* and *z* must be different digits — otherwise the inventory would just contain (*w*+*y*)*z* instead of *wxyz*. So consecutive even numbered place digits (2nd, 4th, 6th… digits) of an inventory must differ. And *that* means the maximum value for an odd numbered place is 3 — you can’t get the same digit in four consecutive places. (Unless you start with that, of course.)

So if we start with palindrome *abba* and a subsequent inventory contains *abba*, then in that subsequent inventory one of the *a*s and one of the *b*s occurs in an odd numbered place. That means both *a* and *b* must be no greater than 3. On the other hand, 2(*a*+*b*) > 9, so neither *a* nor *b* is less than 2. Our only possibilities are 2332, or 3223 (not 3333 since that can’t occur in an inventory):

- 2332 -> 122312 -> 1122131112 -> 212211133112 -> 12112231232112 -> 1112212213111213122112 -> 3122112211133112111311222112 … not obvious that this leads to a solution or not
- 3223 -> 132213 -> 1113221113 -> 311
**3223**113 -> 13211322132113 -> 1113122113221113122113 -> 31131122211**3223**11311222113 solution! Notice the pattern here, each inventory takes the form [digits]22[digits], so the initial number recurs whenever the inventory starts with a 3. The pattern would break if the inventory ever started with 2… does it? I haven’t figured out how to prove it doesn’t.

I haven’t thought of a way to prove 2332 never recurs, either.

I love what you guys tend to be up too. Such clever work and coverage!

Keep up the amazing works guys I’ve added you guys to blogroll.