## 5 Reputation

5 years, 162 days

## The BBP Algorithm for Pi in Maple...

Maple

I have a problem with this question; I have to calculate the 1536 hexadecimal digit of pi and the next 5 digits with a spigot algorithm. My difficulty is to build a procedure in Maple; on the theoretical level i'm clearheaded. here there is a pdf file that explains this procedure

bbp-alg.pdf

## How do I solve this sequence in Maple?...

Maple

I have a problem with this sequence, as defined : f(x)=1-1/x+2*trunc(1/x)

The sequence starts with the number x=50100 and with 100000 steps the aim of the sequence is to see how many numbers are between 0 and 1( and 1 and 2, 2 and 3, and 3 and 4). My idea is:

f:=x->1-2*(1/x-trunc(1/x))+1/x;
x:=50100;
k:=0 : a:=0 : b:=0 : c:=0 : d:=0 : while k<100000 do x:=f(x): k:=k+1 : if(x>0 and x<1)   then(a=a+1)           elif(x>1 and x<2) then(b=b+1) elif(x<2 and x>3) then(c=c+1) elif (x>3 and x<4) then (d=d+1) end             if : end do: printf("%d %d %d %d", a,b,c,d)                                                                                                                                             But i have problems :(.  Does anyone see the mistake?

 Page 1 of 1
﻿