# Is this number unique?

Inspired by Interview Question or Pathbreaking puzzle and A121808.

Start with $1$, and count the number of times $1$ occurs, and report this in the format 'number of ones:1', i.e. the next term is $11$.

Repeating this, we get:

$1, 11, 12, 1121, 1321, 122131, 132231, 122232, 112431, 13213141, 14213241, 13223142, 12233241, 12233241, 12233241$

which is the OEIS sequence mentioned above.

Note that $12233241$ reports itself.

My question is:

Does any other number report itself?

## 3 Answers

I believe there is an implied restriction from JonMark Perry's comment on Glorfindel's answer that the 'number of Xs' has X going from 1 up to the largest digit in the number (i.e. the 1st, 3rd, 5th digits etc. form the sequence 1, 2, 3 etc.)

In this case, I have another solution:

1322334151 which has 3 1s, 2 2s, 3 3s, 1 4 and 1 5.

(NB: this solution works without the restriction, I just wanted to point out that it observes it.)

Here is an exhaustive list, with the assumption that OP expects all digits to be present (IOW the resulting numbers all match a pattern like 1a2b3c4d... with a, b, c,... > 0).

## TL;DR

2 digit numbers (1a): no solution
4 digit numbers (1a2b): no solution
6 digit numbers (1a2b3c): no solution
8 digit numbers (1a2b3c4d): 12233241 and 13213341
10 digit numbers (1a2b3c4d5e): 1322334151
12 digit numbers (1a2b3c4d5e6f): no solution
14 digit numbers (1a2b3c4d5e6f7g): 14233242516171
16 digit numbers (1a2b3c4d5e6f7g8h): 1523324152617181
18 digit numbers (1a2b3c4d5e6f7g8h9i): 162332415162718191

## Two digit numbers (1a)

a can only be 2 (the total number of digits) which leads to an impossibility, therefore there is no solution

## Four digit numbers (1a2b)

Forewords: below, the notation (n eq m) yields 1 if n equals m and 0 otherwise

We can state:
a = 1 + (a eq 1) + (b eq 1)
b = 1 + (a eq 2) + (b eq 2)
sum = a + b = 4 (total number of digits)

a = 1 leads to a paradox
a = 2 leads to a paradox too: b = 2 + (b eq 2)
Therefore there is no solution

## Six digit numbers (1a2b3c)

We can state:
a = 1 + (a eq 1) + (b eq 1) + (c eq 1)
b = 1 + (a eq 2) + (b eq 2) + (c eq 2)
c = 1 + (a eq 3) + (b eq 3) + (c eq 3)
sum = a + b + c = 6 (total number of digits)

a = 1 leads to a paradox
a = 3 implies b = c = 1, which is impossible (sum = 6)
If a = 2, then b >= 2, therefore c = 1, which implies b = 3. This can only be possible if c = 2 which leads us to a paradox, therefore there is no solution

## Eight digit numbers (1a2b3c4d)

We can state:
a = 1 + (a eq 1) + (b eq 1) + (c eq 1) + (d eq 1)
b = 1 + (a eq 2) + (b eq 2) + (c eq 2) + (d eq 2)
c = 1 + (a eq 3) + (b eq 3) + (c eq 3) + (d eq 3)
d = 1 + (a eq 4) + (b eq 4) + (c eq 4) + (d eq 4)
sum = a + b + c + d = 8 (total number of digits)

a = 1 leads to a paradox
a = 4 implies both d >= 2 and d = 1
b = 4 implies a = c = d = 2 which is impossible (sum = 8)
c = 4 implies implies a = b = d = 3 which is impossible (sum = 8)

Therefore d is 1 and we now have:
a = 2 + (b eq 1) + (c eq 1)
b = 1 + (a eq 2) + (b eq 2) + (c eq 2)
c = 1 + (a eq 3) + (b eq 3) + (c eq 3)
d = 1
If a = 2 then b >= 2 and c >= 2. b can only be 3 since b = 2 leads to a paradox. Thus c = 2 (sum = 8).
Therefore a solution is 12233241 (this was given by the OP)
If a = 3 then c >= 2 and b = 1, which is only possible if c = 3 since the sum of all digits is 8.
Therefore the only other solution is 13213341

## Ten digit numbers (1a2b3c4d5e)

We can state:
a = 1 + (a eq 1) + (b eq 1) + (c eq 1) + (d eq 1) + (e eq 1)
b = 1 + (a eq 2) + (b eq 2) + (c eq 2) + (d eq 2) + (e eq 2)
c = 1 + (a eq 3) + (b eq 3) + (c eq 3) + (d eq 3) + (e eq 3)
d = 1 + (a eq 4) + (b eq 4) + (c eq 4) + (d eq 4) + (e eq 4)
e = 1 + (a eq 5) + (b eq 5) + (c eq 5) + (d eq 5) + (e eq 5)
sum = a + b + c + d + e = 10

a = 1 leads to a paradox
a = 5 implies b = c = d = e = 1 which doesn't fit sum
e <= 2, else if e >= 3, at least two of a,b,c,d=5 and the others are >= 1, which yields a total number of digits >= 5+5+1+1+3 = 15 which is higher than sum
d <= 2 else, similarly to method for e, digits >= 13 > sum
c <= 3 else digits >= 14 > sum
b <= 3 else digits >= 11 > sum
e = 2 implies either a = 1 (no) or a = 5 (not with e = 2) therefore e = 1

We now have:
a = 2 + (b eq 1) + (c eq 1) + (d eq 1)
b = 1 + (a eq 2) + (b eq 2) + (c eq 2) + (d eq 2)
c = 1 + (a eq 3) + (b eq 3) + (c eq 3)
d = 1 + (a eq 4)
e = 1

a = 4 implies d = 2, b = c = 1 which doesn't fit sum, therefore d = 1, a = 3, b >= 2 and c >= 2
c = 2 implies b = 2 which doesn't fit sum, therefore c = 3 and b = 2
Therefore there is only one solution: 1322334151 (found by boboquack)

## Twelve digit numbers (1a2b3c4d5e6f)

We can state:
a = 1 + (a eq 1) + (b eq 1) + (c eq 1) + (d eq 1) + (e eq 1) + (f eq 1)
b = 1 + (a eq 2) + (b eq 2) + (c eq 2) + (d eq 2) + (e eq 2) + (f eq 2)
c = 1 + (a eq 3) + (b eq 3) + (c eq 3) + (d eq 3) + (e eq 3) + (f eq 3)
d = 1 + (a eq 4) + (b eq 4) + (c eq 4) + (d eq 4) + (e eq 4) + (f eq 4)
e = 1 + (a eq 5) + (b eq 5) + (c eq 5) + (d eq 5) + (e eq 5) + (f eq 5)
f = 1 + (a eq 6) + (b eq 6) + (c eq 6) + (d eq 6) + (e eq 6) + (f eq 6)
sum = a + b + c + d + e + f = 12

a = 1 leads to a paradox
a = 6 implies b = c = d = e = f = 1 which doesn't fit sum
f <= 2 else digits >= 18 > sum
e <= 2 else digits >= 16 > sum
d <= 2 else digits >= 14 > sum
c <= 3 else digits >= 15 > sum
b <= 4 else digits >= 14 > sum
f = 2 implies either a = 1 (no) or a = 6 (not with f = 2) therefore f = 1

We now have:
a = 2 + (b eq 1) + (c eq 1) + (d eq 1) + (e eq 1)
b = 1 + (a eq 2) + (b eq 2) + (c eq 2) + (d eq 2) + (e eq 2)
c = 1 + (a eq 3) + (b eq 3) + (c eq 3)
d = 1 + (a eq 4) + (b eq 4)
e = 1 + (a eq 5)
f = 1

a = 5 implies e = 2 and b = c = d = 1 which doesn't fit sum, therefore e = 1 and a >= 3
b = 4 implies a = c = d = 2 but a >= 3, therefore b <= 3
a = 4 implies d = 2, b = 3 (b = 2 impossible) and c = 2 which doesn't fit sum, therefore d = 1 and a >= 4

We now have:
a = 4 + (b eq 1) + (c eq 1)
b = 1 + (b eq 2) + (c eq 2)
c = 1 + (b eq 3) + (c eq 3)
d = 1
e = 1
f = 1

b = 3 is impossible (needs b eq 2), therefore c = 1
So, either b = 1 and a = 6, or b = 2 and a = 5 but in both cases, the total number of digits doesn't match the sum.
Therefore there is no solution.

## Fourteen digit numbers (1a2b3c4d5e6f7g)

We can state:
(snipped, similar to above)
sum = a + b + c + d + e + f + g = 14

a = 1 leads to a paradox
a = 7 implies b = c = d = e = f = g = 1 which doesn't fit sum
g <= 2 else digits >= 21 > sum
f <= 2 else digits >= 19 > sum
e <= 2 else digits >= 17 > sum
d <= 2 else digits >= 15 > sum
c <= 3 else digits >= 16 > sum
b <= 4 else digits >= 15 > sum
g = 2 implies either a = 1 (no) or a = 7 (not with g = 2) therefore g = 1

We now have:
a = 2 + (b eq 1) + (c eq 1) + (d eq 1) + (e eq 1) + (f eq 1)
b = 1 + (a eq 2) + (b eq 2) + (c eq 2) + (d eq 2) + (e eq 2) + (f eq 2)
c = 1 + (a eq 3) + (b eq 3) + (c eq 3)
d = 1 + (a eq 4) + (b eq 4)
e = 1 + (a eq 5)
f = 1 + (a eq 6)
g = 1

a = 6 implies f = 2 and b = c = d = e = 1 which doesn't fit sum, therefore f = 1 and a >= 3
a = 5 implies e = 2 and b = c = d = 1 which doesn't fit sum, therefore e = 1, a = 4, b >= 2, c >= 2 and d >= 2

We now have:
a = 4
b = 1 + (b eq 2) + (c eq 2) + (d eq 2)
c = 1 + (b eq 3) + (c eq 3)
d = 2 + (b eq 4)
e = 1
f = 1
g = 1

Since d <= 2, then d = 2, b = 3 (b = 2 impossible) and c = 2, which leads to the only solution: 14233242516171

## Sixteen digit numbers (1a2b3c4d5e6f7g8h)

We can state:
(snipped, similar to above)
a + b + c + d + e + f + g + h = 16

a = 1 leads to a paradox
h <= 2 else the total number of is > sum
h <= 2 else digits > sum
g <= 2 else digits > sum
f <= 2 else digits > sum
e <= 2 else digits > sum
d <= 3 else digits > sum
c <= 3 else digits > sum
b <= 5 else digits > sum
h = 2 implies a = 8 which is impossible with a and h > 1 therefore h = 1 and a >= 2

We now have:
a = 2 + (b eq 1) + (c eq 1) + (d eq 1) + (e eq 1) + (f eq 1) + (g eq 1)
b = 1 + (a eq 2) + (b eq 2) + (c eq 2) + (d eq 2) + (e eq 2) + (f eq 2) + (g eq 2)
c = 1 + (a eq 3) + (b eq 3) + (c eq 3) + (d eq 3)
d = 1 + (a eq 4) + (b eq 4)
e = 1 + (a eq 5) + (b eq 5)
f = 1 + (a eq 6)
g = 1 + (a eq 7)
h = 1

a = 7 implies g = 2 and b = c = d = e = f = 1 which doesn't fit sum, therefore g = 1 and a >= 3
a = 6 implies f = 2, b >= 3, c = d = e = 1 which contradicts b >= 3, therefore f = 1 and a >= 4
b = 5 implies a = c = d = e = 2 but a >= 4, therefore b <= 4

We now have:
a = 4 + (b eq 1) + (c eq 1) + (d eq 1) + (e eq 1)
b = 1 + (b eq 2) + (c eq 2) + (d eq 2) + (e eq 2)
c = 1 + (b eq 3) + (c eq 3) + (d eq 3)
d = 1 + (a eq 4) + (b eq 4)
e = 1 + (a eq 5)
f = 1
g = 1
h = 1

b = 4 implies c = d = e = 2, a = 4 and thus d = 3, therefore b <= 3
a = 4 implies both e = 1 and e != 1, therefore a = 5
a = 5 implies e = 2, d = 1, b = 3, c = 2, which leads to the only valid solution 1523324152617181

## Eighteen digit numbers (1a2b3c4d5e6f7g8h9i)

We can state:
(snipped, similar to above)
a + b + c + d + e + f + g + h + i = 18

a = 1 leads to a paradox
i <= 2 else the total number of is > sum
h <= 2 else digits > sum g <= 2 else digits > sum f <= 2 else digits > sum e <= 2 else digits > sum d <= 4 else digits > sum c <= 4 else digits > sum b <= 5 else digits > sum i = 2 implies a = 9 which is impossible with a and i > 1 therefore i = 1 and a >= 2

We now have:
a = 2 + (b eq 1) + (c eq 1) + (d eq 1) + (e eq 1) + (f eq 1) + (g eq 1) + (h eq 1)
b = 1 + (a eq 2) + (b eq 2) + (c eq 2) + (d eq 2) + (e eq 2) + (f eq 2) + (g eq 2) + (h eq 2)
c = 1 + (a eq 3) + (b eq 3) + (c eq 3) + (d eq 3)
d = 1 + (a eq 4) + (b eq 4) + (c eq 4) + (d eq 4)
e = 1 + (a eq 5) + (b eq 5)
f = 1 + (a eq 6)
g = 1 + (a eq 7)
h = 1 + (a eq 8)
i = 1

a = 8 implies h = 2, b >= 3 and a <= 7, therefore h = 1, a >= 3
a = 7 implies g = 2, b >= 3, c = d = e = f = 1 which contradicts b >= 3, therefore g = 1, a >= 4
a = 6 implies f = 2, b >= 3, c >= 2, d = e = 1, therefore b = 3 and c = 2. This leads us to one solution: 162332415162718191

If a <= 5, then f = 1, thus a = 5 and b, c, d, e > 1, therefore e = 2, b >= 3, b <= 4 and we have:
a = 5
b = 2 + (c eq 2) + (d eq 2)
c = 1 + (b eq 3) + (c eq 3) + (d eq 3)
d = 1 + (b eq 4) + (c eq 4) + (d eq 4)
e = 2
f = 1
g = 1
h = 1
i = 1

b = 4 implies c = d = 2 but c = 2 implies one of b, c, d equals 3, therefore b = 3 and c >= 2
c = 4 impossible (needs c eq 3)
d = 4 impossible (needs b eq 4), therefore d = 1 which contradicts d > 1 (a = 5)
Therefore a cannot be <= 5 and we have found the only solution above.

• @JonMarkPerry I rollbacked your last edit which I didn't fully grasp. I gave details on my reasoning. Tell me if I'm missing something. – xhienne Sep 5 '18 at 10:12
• I can see that now, my method involves putting e=4 into the (d) eqn. - at least 2 must be 4, etc... – JonMark Perry Sep 5 '18 at 10:22
• which I can now see is garbage! – JonMark Perry Sep 5 '18 at 10:32
• Anyway, it's nice you could have a look on such a long post and validate my findings. I'll soon come up with the remaining of that analysis, be patient. – xhienne Sep 5 '18 at 10:39
• I checked up to 10, then I fell asleep! :). you can use hex to get to 32digits, although this introduces a new twist. – JonMark Perry Sep 5 '18 at 11:22

Yes, there is.

22 (contains the number 2, 2 times)

• arguably goes to 1022 n'est-ce pas? – JonMark Perry Sep 4 '18 at 7:03
• No, just like 1 goes to 11 and not 1120304050... – Glorfindel Sep 4 '18 at 7:04