A Walk on the Wide Side

How wide is a number? The obvious answer is to count digits and say that 1 and 9 are one digit wide, 11 and 99 are two digits wide, 111 and 999 are three digits wide, and so on. But that isn’t a very good answer. 111 and 999 are both three digits wide, but 999 is nine larger times than 111. And although 111 and 999 are both one digit wider than 11 and 99, 111 is much closer to 99 than 999 is to 111.

So there’s got to be a better answer to the question. I came across it indirectly, when I started looking at carries in powers. I wanted to know how fast a number grew in digit-width as it was multiplied repeatedly by, say, 2. For example, 2^3 = 8 and 2^4 = 16, so there’s been a carry at the far left and 2^4 = 16 has increased in digit-width by 1 over 2^3 = 8. After that, 2^6 = 64 and 2^7 = 128, so there’s another carry and another increase in digit-width. I wrote a program to sum the carries and divide them by the power. If I were better at math, I would’ve known what the value of carries / power was going to be. Here’s the program beginning to find it (it begins with a carry of 1, to mark 2^0 = 1 as creating a digit ex nihilo, as it were):


8 = 2^3
16 = 2^4 → 2 / 4 = 0.5
64 = 2^6
128 = 2^7 → 3 / 7 = 0.4285714285714285714285714286
512 = 2^9
1024 = 2^10 → 4 / 10 = 0.4
8192 = 2^13
16384 = 2^14 → 5 / 14 = 0.3571428571428571428571428571
65536 = 2^16
131072 = 2^17 → 6 / 17 = 0.3529411764705882352941176471
524288 = 2^19
1048576 = 2^20 → 7 / 20 = 0.35
8388608 = 2^23
16777216 = 2^24 → 8 / 24 = 0.3...
67108864 = 2^26
134217728 = 2^27 → 9 / 27 = 0.3...
536870912 = 2^29
1073741824 = 2^30 → 10 / 30 = 0.3...
8589934592 = 2^33
17179869184 = 2^34 → 11 / 34 = 0.3235294117647058823529411765
68719476736 = 2^36
137438953472 = 2^37 → 12 / 37 = 0.3243243243243243243243243243
549755813888 = 2^39
1099511627776 = 2^40 → 13 / 40 = 0.325
8796093022208 = 2^43
17592186044416 = 2^44 → 14 / 44 = 0.318...
70368744177664 = 2^46
140737488355328 = 2^47 → 15 / 47 = 0.3191489361702127659574468085
562949953421312 = 2^49
1125899906842624 = 2^50 → 16 / 50 = 0.32
9007199254740992 = 2^53
18014398509481984 = 2^54 → 17 / 54 = 0.3148...
72057594037927936 = 2^56
144115188075855872 = 2^57 → 18 / 57 = 0.3157894736842105263157894737
576460752303423488 = 2^59
1152921504606846976 = 2^60 → 19 / 60 = 0.316...
9223372036854775808 = 2^63
18446744073709551616 = 2^64 → 20 / 64 = 0.3125
73786976294838206464 = 2^66
147573952589676412928 = 2^67 → 21 / 67 = 0.3134328358208955223880597015
590295810358705651712 = 2^69
1180591620717411303424 = 2^70 → 22 / 70 = 0.3142857...
9444732965739290427392 = 2^73
18889465931478580854784 = 2^74 → 23 / 74 = 0.3108...
75557863725914323419136 = 2^76
151115727451828646838272 = 2^77 → 24 / 77 = 0.3116883...
604462909807314587353088 = 2^79
1208925819614629174706176 = 2^80 → 25 / 80 = 0.3125
9671406556917033397649408 = 2^83
19342813113834066795298816 = 2^84 → 26 / 84 = 0.3095238095238095238095238095
77371252455336267181195264 = 2^86
154742504910672534362390528 = 2^87 → 27 / 87 = 0.3103448275862068965517241379
618970019642690137449562112 = 2^89
1237940039285380274899124224 = 2^90 → 28 / 90 = 0.31...
9903520314283042199192993792 = 2^93
19807040628566084398385987584 = 2^94 → 29 / 94 = 0.3085106382978723404255319149
79228162514264337593543950336 = 2^96
158456325028528675187087900672 = 2^97 → 30 / 97 = 0.3092783505154639175257731959
633825300114114700748351602688 = 2^99
1267650600228229401496703205376 = 2^100 → 31 / 100 = 0.31

After calculating 2^p higher and higher (I discarded trailing digits of 2^p), I realized that the answer — carries / power — was converging on a value of slightly less than 0.30103. In the end (doh!), I realized that what I was calculating was the logarithm of 2 in base 10:


log(2) = 0.3010299956639811952137388947...
10^0.301029995663981... = 2

You can use then same carries-and-powers method to approximate the values of other logarithms:


log(1) = 0
log(2) = 0.3010299956639811952137388947...
log(3) = 0.4771212547196624372950279033...
log(4) = 0.6020599913279623904274777894...
log(5) = 0.6989700043360188047862611053...
log(6) = 0.7781512503836436325087667980...
log(7) = 0.8450980400142568307122162586...
log(8) = 0.9030899869919435856412166842...
log(9) = 0.9542425094393248745900558065...

I also realized logarithms are a good answer to the question I raised above: How wide is a number? The logs of the powers of 2 are multiples of log(2):


    log(2^1) = log(2) = 0.301029995663981195213738894
    log(2^2) = log(4) = 0.602059991327962390427477789 = 2 * log(2)
    log(2^3) = log(8) = 0.903089986991943585641216684 = 3 * log(2)
   log(2^4) = log(16) = 1.204119982655924780854955579 = 4 * log(2)
   log(2^5) = log(32) = 1.505149978319905976068694474 = 5 * log(2)
   log(2^6) = log(64) = 1.806179973983887171282433368 = 6 * log(2)
  log(2^7) = log(128) = 2.107209969647868366496172263 = 7 * log(2)
  log(2^8) = log(256) = 2.408239965311849561709911158 = 8 * log(2)
  log(2^9) = log(512) = 2.709269960975830756923650053 = 9 * log(2)
log(2^10) = log(1024) = 3.010299956639811952137388947 = 10 * log(2)

4 is 2 times larger than 2 and, in a sense, the width of 4 is 0.301029995663981… greater than the width of 2. As you can see, when the integer part of the log-sum increases by 1, so does the digit-width of the power:


 log(2^3) = log(8) = 0.903089986991943585641216684 = 3 * log(2)
log(2^4) = log(16) = 1.204119982655924780854955579 = 4 * log(2)

[...]

 log(2^6) = log(64) = 1.806179973983887171282433368 = 6 * log(2)
log(2^7) = log(128) = 2.107209969647868366496172263 = 7 * log(2)

[...]

  log(2^9) = log(512) = 2.709269960975830756923650053 = 9 * log(2)
log(2^10) = log(1024) = 3.01029995663981195213738894 = 10 * log(2)

In other words, powers of 2 are increasing in width by 0.301029995663981… units. When the increase flips the integer part of the log-sum up by 1, the digit-width or digit-count also increases by 1. To find the digit-count of a number, n, in a particular base, you simply take the integer part of log(n,b) and add 1. In base 10, the log of 123456789 is 8.091514… The integer part is 8 and 8+1 = 9. But it also makes perfect sense that log(1) = 0. No matter how many times you multiply a number by 1, the number never changes. That is, its width stays the same. So you can say that 1 has a width of 0, while 2 has a width of 0.301029995663981…

Logarithms also answer a question pre-previously raised on Overlord of the Über-Feral: Why are the Fibonacci numbers so productive in base 11 for digsum(fib(k)) = k? In base 10, such numbers are quickly exhausted:


digsum(fib(1)) = 1 = digsum(1)
digsum(fib(5)) = 5 = digsum(5)
digsum(fib(10)) = 10 = digsum(55)
digsum(fib(31)) = 31 = digsum(1346269)
digsum(fib(35)) = 35 = digsum(9227465)
digsum(fib(62)) = 62 = digsum(4052739537881)
digsum(fib(72)) = 72 = digsum(498454011879264)
digsum(fib(175)) = 175 = digsum(1672445759041379840132227567949787325)
digsum(fib(180)) = 180 = digsum(18547707689471986212190138521399707760)
digsum(fib(216)) = 216 = digsum(619220451666590135228675387863297874269396512)
digsum(fib(251)) = 251 = digsum(12776523572924732586037033894655031898659556447352249)
digsum(fib(252)) = 252 = digsum(20672849399056463095319772838289364792345825123228624)
digsum(fib(360)) = 360
digsum(fib(494)) = 494
digsum(fib(540)) = 540
digsum(fib(946)) = 946
digsum(fib(1188)) = 1188
digsum(fib(2222)) = 2222

In base 11, such numbers go on and on:


digsum(fib(1),b=11) = 1 = digsum(1) (k=1)
digsum(fib(5),b=11) = 5 = digsum(5) (k=5)
digsum(fib(12),b=11) = 12 = digsum(1A2) (k=13)
digsum(fib(38),b=11) = 38 = digsum(855138A1) (k=41)
digsum(fib(49)) = 49 = digsum(2067A724762) (k=53) (c=5)
digsum(fib(50)) = 50 = digsum(542194A6905) (k=55)
digsum(fib(55)) = 55 = digsum(54756364A280) (k=60)
digsum(fib(56)) = 56 = digsum(886283256841) (k=61)
digsum(fib(82)) = 82 = digsum(57751318A9814A6410) (k=90)
digsum(fib(89)) = 89 = digsum(140492673676A06482A2) (k=97)
digsum(fib(144)) = 144 = digsum(401631365A48A784A09392136653457871) (k=169) (c=10)
digsum(fib(159)) = 159 = digsum(67217257641069185100889658A1AA72A0805) (k=185)
digsum(fib(166)) = 166 = digsum(26466A3A88237918577363A2390343388205432) (k=193)
digsum(fib(186)) = 186 = digsum(6A963147A9599623A20A05390315140A21992A96005) (k=215)
digsum(fib(221)) = 221 (k=265) (c=15)
digsum(fib(225)) = 225 (k=269)
digsum(fib(2A1)) = 2A1 (k=353)
digsum(fib(2A3)) = 2A3 (k=355)

[...]

digsum(fib(39409)) = 39409 (k=56395)
digsum(fib(3958A)) = 3958A (k=56605) (c=295)
digsum(fib(3965A)) = 3965A (k=56693)
digsum(fib(3A106)) = 3A106 (k=57360)
digsum(fib(3AA46)) = 3AA46 (k=58493)
digsum(fib(40140)) = 40140 (k=58729)
digsum(fib(4222A)) = 4222A (k=61500) (c=300)
digsum(fib(42609)) = 42609 (k=61961)
digsum(fib(42775)) = 42775 (k=62155)
digsum(fib(4287A)) = 4287A (k=62281)
digsum(fib(430A2)) = 430A2 (k=62669)
digsum(fib(43499)) = 43499 (k=63149) (c=305)
digsum(fib(435A9)) = 435A9 (k=63281)

[...]

digsum(fib(157476)) = 157476 (k=244140) (c=525)
digsum(fib(158470)) = 158470 (k=245465)
digsum(fib(159037)) = 159037 (k=246275)
digsum(fib(159285)) = 159285 (k=246570)
digsum(fib(159978)) = 159978 (k=247409)
digsum(fib(162993)) = 162993 (k=252750) (c=530)
digsum(fib(163A32)) = 163A32 (k=254135)
digsum(fib(164918)) = 164918 (k=255329)
digsum(fib(166985)) = 166985 (k=258065)
digsum(fib(167234)) = 167234 (k=258493)
digsum(fib(167371)) = 167371 (k=258655) (c=535)
digsum(fib(1676A5)) = 1676A5 (k=259055)
digsum(fib(16992A)) = 16992A (k=261997)

[...]

When do these numbers run out in base 11? I don’t know, but I do know why there are so many of them. The answer involves the logarithm of a special number. The most famous aspect of Fibonacci numbers is that the ratio, fib(k) / fib(k-1), of successive numbers converges on an irrational constant known as Φ. Here are the first Fibonacci numbers, where fib(k) = fib(k-2) + fib(k-1) (in other words, 1+1 = 2, 1+2 = 3, 2+3 = 5, and so on):


1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, ...

And here are the first ratios:


1 / 1 = 1
2 / 1 = 2
3 / 2 = 1.5
5 / 3 = 1.6...
8 / 5 = 1.6
13 / 8 = 1.625
21 / 13 = 1.6153846...
34 / 21 = 1.619047...
55 / 34 = 1.617647058823529411764705882
89 / 55 = 1.618...
144 / 89 = 1.617977528089887640449438202
233 / 144 = 1.61805...
377 / 233 = 1.618025751072961373390557940
610 / 377 = 1.618037135278514588859416446
987 / 610 = 1.618032786885245901639344262
1597 / 987 = 1.618034447821681864235055724
2584 / 1597 = 1.618033813400125234815278648
4181 / 2584 = 1.618034055727554179566563468
6765 / 4181 = 1.618033963166706529538387946
[...]

The ratios get closer and closer to Φ = 1.618033988749894848204586834… = (√5 + 1) / 2. In other words, fib(k) ≈ fib(k-1) * Φ = fib(k-1) * 1.618… in base 10. This means that the digit-length of fib(k) ≈ integer(k * log(&Phi)) + 1. In base b, the average value of a digit in a Fibonacci number is (b^2-b) / 2b. Therefore in base 10, the average value of a digit is (10^2-10) / 20 = 90 / 20 = 4.5. The average value of digsum(fib(k)) ≈ 4.5 * log(&Phi) * k = 4.5 * 0.20898764… * k = 0.940444… * k. It isn’t surprising that as fib(k) gets larger, digsum(fib(k)) tends to get smaller than k.

In base 10, anyway. But what about base 11? In base 11, log(Φ) = 0.20068091818623… and the average value of a base-11 digit in fib(k) is 5 = 110 / 22 = (11^2 – 11) / 22. Therefore the average value of digsum(fib(k)) in base 11 is 5 * log(&Phi) * k = 5 * 0.20068091818623… * k = 1.00340459… * k. The average value of digsum(fib(k)) is much closer to k and it’s not surprising that for so many fib(k) in base 11, digsum(fib(k)) = k. In base 11, log(Φ) ≈ 1/5 and because the average digval is 5, digsum(fib(k)) ≈ 5 * 1/5 * k = 1 * k = k. As we’ve seen, that isn’t true in base 10. Nor is it true in base 12, where log(Φ) = 0.1936538843826… and average digval is 5.5 = (12^2 – 12) / 24 = 132 / 24. Therefore the average value in base 12 of digsum(fib(k)) = 1.0650963641… * k. The function digsum(fib(k)) = k rapidly dries up in base 12, just as it does in base 10:


digsum(fib(1),b=12) = 1 = digsum(1) (k=1)
digsum(fib(5),b=12) = 5 = digsum(5) (k=5)
digsum(fib(11) = 11 = digsum(175) (k=13)
digsum(fib(12) = 12 = digsum(275) (k=14)
digsum(fib(75) = 75 = digsum(976446538A0863811) (k=89) (c=5)
digsum(fib(80) = 80 = digsum(1B3643B50939808B400) (k=96)
digsum(fib(A3) = A3 = digsum(35147A566682BB9529034402) (k=123)
digsum(fib(165) = 165 (k=221)
digsum(fib(283) = 283 (k=387)
digsum(fib(2AB) = 2AB (k=419) (c=10)
digsum(fib(39A) = 39A (k=550)
digsum(fib(460) = 460 (k=648)
digsum(fib(525) = 525 (k=749)
digsum(fib(602) = 602 (k=866)
digsum(fib(624) = 624 (k=892) (c=15)
digsum(fib(781) = 781 (k=1105)
digsum(fib(1219) = 1219 (k=2037)


Previously Pre-Posted…

Mötley Vüe — more on digsum(fib(k)) = k