(* Collection of code snippets by Arne Vajhøj *)
(* (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) *)
program test(input,output);

const
   N = 1000000000;

var
   i, sum, t1, t2 : integer;

begin
   t1 := clock;
   sum := 0;
   for i := 0 to (N - 1) do begin
      sum := ((sum + 1) * 2 + 1) div 2;
   end;
   t2 := clock;
   if sum <> N then begin
      writeln('Error');
   end else begin
      writeln(N:1, ' operations in ', ((t2 - t1) div 1000):1, ' seconds');
   end;
end.
