Determine the probability that for a positive integer N drawn at random between 2 and 201 inclusively, the sum of the digits in the base N representation of 2011 (base ten) is a perfect square.
19 out of the 200 numbers in this range satisfy the condition, for a probability of 19/200 = 0.095, or about 1/10.5263157894736842104.
N
(base) sod base-10 representation of the base-N digits
2 9 1 1 1 1 1 0 1 1 0 1 1
3 9 2 2 0 2 1 1 1
8 16 3 7 3 3
10 4 2 0 1 1
20 16 5 0 11
22 16 4 3 9
26 36 2 25 9
60 64 33 31
80 36 25 11
92 100 21 79
106 121 18 103
110 49 18 31
127 121 15 106
134 16 15 1
136 121 14 107
148 100 13 87
178 64 11 53
190 121 10 111
194 81 10 71
stats:
19 200 19//200 0.095 10.5263157894736842104
list
5 dim Dig(20)
10 for N=2 to 201
20 Sod=0:NumDigs=0
30 Num=2011
40 while Num>0
50 D=Num @ N:inc NumDigs:Dig(NumDigs)=D
60 Sod=Sod+D
70 Num=Num\N
80 wend
90 Sr=int(sqrt(Sod)+0.5)
100 if Sr*Sr=Sod then inc Psqrs
101 :print N,Sod,
102 :for I=NumDigs to 1 step -1
103 :print Dig(I);
104 :next:print
110 inc NCt
120 next N
130 print Psqrs,NCt,Psqrs//NCt,Psqrs/NCt,NCt/Psqrs
OK
|
Posted by Charlie
on 2011-06-22 13:51:00 |