For a randomly chosen real number x on the interval (0,10) find the exact probability of each:
(1) That x and 2^{x} have the same first digit
(2) That x and x^{2} have the same first digit
(3) That x^{2} and 2^{x} have the same first digit.
(4) That x, x^{2} and 2^{x} all have the same first digit.
First digit refers to the first nonzero digit of the number written in decimal form.
Corrections made below, in light of Jer's correction (comment 11) are made in bold:
x^2 and 2^x:
Above 1, this isn't too hard:
2 matches 2 from sqrt(2) to log(3)/log(2), the latter aka lb(3)
3 matches 3 from sqrt(3) to 2
4 matches 4 from 2 to sqrt(5)
5 matches 5 from lb(5) to sqrt(6)
6 matches 6 from lb(6) to sqrt(7)
7 matches 7 from lb(7) to sqrt(8)
8 has probability zero of matching 8 (3^2 = 8.9999... & 2^3 = 8  only 1 point)
1 matches 1 from lb(10) to lb(20)
2 matches 2 again from sqrt(20) to lb(30)
9 matches 9 from lb(900) to lb(1000)
Below 1, as before, 2^x begins with a digit 1, so the question becomes What fraction of the squares begin with a digit 1?
Out of the range .1 to .99..., those x's from .1 to sqrt(2)/10 have squares beginning with a 1. Thus the probability within this range is (sqrt(2)/10  .1) / .9.
Also, from sqrt(.1) to sqrt(.2) the squares begin with a 1. This adds to the total probability within the 0 to 1 range, making it (sqrt(2)/10  .1 + sqrt(.2)  sqrt(.1)) / .9.
But this same probability also applies in each of the infinitely many orders of magnitude for x, and so (sqrt(2)/10  .1 + sqrt(.2)  sqrt(.1)) / .9 is the correct probability for all of the 0 to .999999... range.
We thus get
((sqrt(2)/10  .1 + sqrt(.2)) / .9 +lb(3) + 2 + sqrt(5) + sqrt(6) + sqrt(7) + sqrt(8) + lb(20) +lb(30) + lb(1000)  sqrt(2)  sqrt(.1)  sqrt(3)  2  lb(5)  lb(6)  lb(7)  lb(10)  sqrt(20)  lb(900)) / 10
= ((sqrt(2)/10  .1 + sqrt(.2)) / .9 +lb(3) + sqrt(5) + sqrt(6) + sqrt(7) + sqrt(8) + lb(20) +lb(30) + lb(1000)  sqrt(2)  sqrt(.1)  sqrt(3)  lb(5)  lb(6)  lb(7)  lb(10)  sqrt(20)  lb(900)) / 10
=
((sqrt(2)/10  .1) / .9 + sqrt(.2) +log(3)/log(2) + sqrt(5) + sqrt(6) + sqrt(7) + sqrt(8) + log(20)/log(2) +log(30)/log(2) + log(1000)/log(2)  sqrt(2)  sqrt(.1)  sqrt(3)  log(5)/log(2)  log(6)/log(2)  log(7)/log(2)  log(10)/log(2)  sqrt(20)  log(900)/log(2)) / 10
~= .264795606189634 rather than .251697023241324
This now agrees with the simulation, to a reasonable statistical difference.
I suspect this is low for some reason, as a simulation of a million trials finds 267079 matches:
DEFDBL AZ
RANDOMIZE TIMER
PRINT (1 / 10 + LOG(60) / LOG(2)  LOG(50) / LOG(2) + LOG(70) / LOG(2)  6 + LOG(1000) / LOG(2)  LOG(900) / LOG(2)) / 10
FOR tr = 1 TO 1000000
x = 10 * RND(1)
y = 2 ^ x
s1$ = STR$(x * x): s2$ = STR$(y)
FOR i = 1 TO LEN(s1$)
IF INSTR("123456789", MID$(s1$, i, 1)) THEN m1$ = MID$(s1$, i, 1): EXIT FOR
NEXT
FOR i = 1 TO LEN(s2$)
IF INSTR("123456789", MID$(s2$, i, 1)) THEN m2$ = MID$(s2$, i, 1): EXIT FOR
NEXT
IF m1$ = m2$ THEN ct = ct + 1
PRINT ct; tr,
PRINT USING "#.#######"; ct / tr
NEXT tr
Edited on March 30, 2011, 2:45 pm

Posted by Charlie
on 20110329 22:27:42 