Question: Counting integer strings in pi

I'm trying to write a code to find out how many strings of 3 or more same numbers appear in the first 10000 digits of pi. This is what I wrote but I know it's very very inneficient, although it does seem to work I think...

A := NULL:
a := NULL:
for k from 0 to 9997 do
a := [floor(evalf[10000]((10^k)*Pi)) mod 10,
floor(evalf[10000]((10^(k+1))*Pi)) mod 10,
floor(evalf[10000]((10^(k+2))*Pi)) mod 10]:
if a[1]=a[2] and a[1]=a[3] then
A := A+1:
k := k+3
end if:
end do:
A;

 

Anyone know of a more efficient code?

Please Wait...