Run Fun

I was looking at numbers where the digit-runs of n in one base, b1, represented the digits of n in another base, b2. To understand digit-runs, take the number 775555111 (in whatever base). The function digitrun(775555111) = 2,4,3, because reading 775555111 left-to-right you see two 7s, four 5s, three 1s. Here’s one pattern I found:

10000011111 in base 2 = 1055 in base 10. The digit runs of 10000011111 are 1,5,5 and 15530 = 105510 = 100000111112.
10000022222 in base 3 = 59291 in base 10. The digit runs of 10000022222 are again 1,5,5 and 155241 = 5929110 = 100000222223.
1000009999910 → 1,5,5 and 15599998 = 1000009999910

The pattern isn’t difficult to understand — what are 30+2 and 99998+2? — and it’s easy to prove that it applies to all standard bases. But I wondered how AI would go about the proof. Here’s the result:

For base b ≥ 2, let the largest digit be d = b − 1. Then

100000dddddb

has digit runs

1, 5, 5

so the run-length encoding is always

155.

The value of 155 is interpreted in base

b5 − 2,

because

155b5−2 = (b5−2)2 + 5(b5−2) + 5.

Thus

100000dddddb = 155b5−2.

Base b n = 100000(b−1)(b−1)(b−1)(b−1)(b−1)b Run Lengths Compressed Form Base-10 Value of n
2 100000111112 1,5,5 15530 1,055
3 100000222223 1,5,5 155241 59,291
4 100000333334 1,5,5 1551022 1,049,599
5 100000444445 1,5,5 1553123 9,765,624
6 100000555556 1,5,5 1557774 60,466,175
7 100000666667 1,5,5 15516805 282,475,248
8 100000777778 1,5,5 15532766 1,074,266,111
9 100000888889 1,5,5 15559047 3,486,270,320
10 1000009999910 1,5,5 15599998 10,000,099,999
11 100000AAAAA11 1,5,5 155161049 26,094,908,050
12 100000BBBBB12 1,5,5 155248830 62,191,972,031
13 100000CCCCC13 1,5,5 155371291 136,858,491,292
14 100000DDDDD14 1,5,5 155537822 281,793,968,543
15 100000EEEEE15 1,5,5 155759373 547,918,611,874
16 100000FFFFF16 1,5,5 1551048574 1,099,512,627,199
17 100000GGGGG17 1,5,5 1551419855 2,141,423,647,200
18 100000HHHHH18 1,5,5 1551889566 4,058,363,974,751
19 100000IIIII19 1,5,5 1552476097 7,502,570,010,432
20 100000JJJJJ20 1,5,5 1553199998 13,120,000,000,000

(Here A = 10, B = 11, …, J = 19.)

Proof for All b ≥ 2

The number

100000(b−1)(b−1)(b−1)(b−1)(b−1)b

has value

b10 + (b−1)(b4 + b3 + b2 + b + 1).

Since

b4 + b3 + b2 + b + 1 = (b5 − 1)/(b − 1),

this becomes

b10 + (b5 − 1) = b10 + b5 − 1.

Now let

B = b5 − 2.

Then

155B = B2 + 5B + 5.

Substituting B = b5 − 2:

(B2 + 5B + 5) = (b5−2)2 + 5(b5−2) + 5

= b10−4b5+4+5b5−10+5

= b10 + b5−1.

Hence

b10 + b5 − 1 = (b5 − 2)2+5(b5 − 2)+5

for every b ≥ 2.

Therefore,

100000(b−1)5b = 155b5−2.

This is exactly the pattern observed in bases 2 to 20, and it holds for all bases.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.