kill(all)$

          Make this work so that you can ask the question:
          What is the depth(x) in pi, if x is a two digit number.
          How many occurrences of x occur in pi by k digits.
          depth(x,u) is defined as how many digits into u, the number x is found for the first time.
          Compute and draw depth(x,pi) for x between 0 and 100.

van=facebook.com/LearningCalculus$

L:100$
fpprec:L$

pi:rat(bfloat(%pi*10^L));

s:string(pi);

result: array(foo, L);

for i: 1 thru L do foo[i]:0$

l:2$

for n: 10 thru 99 do
    for i: 1 thru L-(l+i) do
        if substring(s, i, i+l)=string(n) then (foo[n]:foo[n]+1,print("Answer ", n, "at", i));

 histogram (listarray(foo),            nclasses     = 8,            title        = "pi digits",            xlabel       = "digits",            ylabel       = "Absolute frequency",            fill_color   = grey,            fill_density = 0.6)$

histogram(listarray(foo));

for i: 1 thru L do print(i, foo[i]);