UBASIC is much less expensive than Mathematica, and does the job.
The program tabulates, for the digits 1 through 9, their occurrence as the first digit of 2^N, for N=1 through 332. The statistics match pretty well those expected by Benford's Law.
list
5 dim D(9)
10 for N=1 to 332
20 P=2^N
30 Ps=cutspc(str(P))
40 S=val(left(Ps,1))
50 inc D(S)
60 next
70 for I=1 to 9:print I;D(I):next
OK
run
1 99
2 60
3 40
4 33
5 27
6 23
7 17
8 19
9 14
OK

Posted by Charlie
on 20090808 15:36:41 