(A) For a base ten positive integer P drawn at random between 10 and 99 inclusively, determine the probability that the first two digits (reading left to right) in the base ten
expansion of 2P is equal to P-1.
(B) For a base ten positive integer P drawn at random between 10 and 99 inclusively, determine the probability that the first two digits (reading left to right) in the base ten expansion of 6P is equal to P-1.
I have begun exploring the programming language called Frink, available on the web for free. It has the extended-precision capabilities of UBASIC but is more amenable to structured programming and does not need to run in DOS. The latter is an advantage for ease of use under Windows 7, and also in the use of longer filenames than the DOS's 8 + 3 format, though there doesn't seem to be a direct capability of writing to text files--only to a text window whose contents can be copied to wherever you want. The program file, any input files, and output graphics files, though, take advantage of the file name freedom.
Also, most Frink programs can be run without change on Android devices. Limitation is mostly based on memory usage, say for large graphics.
Here's the Frink solution:
setPrecision[100]
for p = 10 to 99
{
v=2^p
first2=substr["$v",0,2]
v1=eval[first2]
v2=p-1
if v1==v2 then println["$p "+" $v"]
}
println [""]
for p = 10 to 99
{
v=6^p
first2=substr["$v",0,2]
v1=eval[first2]
v2=p-1
if v1==v2 then println["$p "+" $v"]
}
The results, annotated manually, are:
P 2^P
21 2097152
35 34359738368
76 75557863725914323419136
P 6^P
17 16926659444736
38 371319292745659279662190166016
64 63340286662973277706162286946811886609896461828096
As there are 90 integers between 10 and 99 inclusive, each of the requested probabilities is 3/90 = 1/30.
Edited on March 16, 2011, 1:14 pm
|
Posted by Charlie
on 2011-03-16 13:08:32 |