Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Program Pi_Spigot;
- {$R-}
- const
- n = 2000;
- len = 10*n div 3;
- var
- i, j:Int32;
- q, x: Int32;
- a: array[1..len] of Int32;
- tm: Int64;
- begin
- tm := GetTickCount();
- for j := 1 to len do
- a[j] := 2;
- for j := 1 to n do
- begin
- q := 0;
- for i := len downto 1 do
- begin
- x := 10*a[i] + q*i;
- a[i] := x mod (2*i - 1);
- q := x div (2*i - 1);
- end;
- end;
- writeln('Used ' + ToStr(GetTickCount() - tm) + ' ms');
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement