uses
strutils;
function qmult(aa:ansistring;bb:ansistring):ansistring;
type
AB = array of byte;
const init:boolean=false;
_mod:AB=nil;
_div:AB=nil;
var
z,i,j,la,lb,tmpi:longint;
tmps,ans:ansistring;
cc:ansistring='';
n,carry,ai:smallint;
a,b,c:pchar;
begin
if (init=false) then
setlength(_mod,100);
setlength(_div,100);
begin {create lookup tables once}
for z:=0 to 99 do
begin
_mod[z]:= (z mod 10) +48;
_div[z]:= z div 10;
end; {created lookup tables}
init:=true;
end;
la:=length(aa);lb:=length(bb);
If Lb>La Then
begin
tmpi:=la;tmps:=aa;
la:=lb;aa:=bb;
lb:=tmpi;bb:=tmps;
end;
Setlength(cc,la+lb);
FillChar(cc[1],la+lb,#48);
a:=@aa[1];b:=@bb[1];c:=@cc[1];
for i:=la-1 downto 0 do
begin
carry:=0;ai:=ord(a[i])-48 ;
for j:= lb-1 downto 0 do
begin
n :=ai*(ord(b[j])-48)+(ord(c[i+j+1])-48)+carry;
carry :=_Div[n];ord(c[i+j+1]):=_Mod[n];
end;
ord(c[i]):=ord(c[i])+carry ;
end;
ans:=c;
if c[1]='0' then ans:=copy(c,2,length(c)-1) ;
exit(ans);
end;
function pow2(n:integer):ansistring;
var
i:integer;
q,ans:ansistring;
begin
q:='2';
for i:=1 to n-1 do q:=qmult('2',q);
ans:=q;
if q[1]='0' then ans:=copy(q,2,length(q)-1) ;
exit(ans);
end;
procedure decrement(var s:ansistring);
var
counts,ls:longint;
b,c,ans:ansistring;
begin
c:='';
ls:=length(s);
counts:=0;
ans:='';b:='';
repeat
while ord(s[ls-counts-1+1])=48 do
begin
counts:=counts+1;
end;
if ord(s[ls-counts-1+1])<>48 Then
begin
ans:=leftstr(s,ls-counts-1);
Str(ord(s[ls-counts-1+1])-49,b);
ans:=ans+b;
setlength(c,counts);
FillChar(c[1],counts,#57);
ans:=ans+c;
s:=ans;
exit;
end;
until (true);
end;
var
i,L:integer;
q,space,gap:ansistring;
begin
for i:=1 to 300 do
begin
gap:='';
q:=pow2(i);
decrement(q);
str(i,space);
L:=length(space);
L:=7-L;
setlength(gap,L);
FillChar(gap[1],L,#32);
write('2^',i,'-1',gap,q,' ');
case q of
'127':write('shortint');
'255':write('byte or uint8');
'32767':write('smallint');
'65535':write('word');
'2147483647':write('longint');
'4294967295':write('longword or cardinal');
'9223372036854775807':write('int64');
'18446744073709551615':write('qword or uint64 (End of numerical)');
'340282366920938463463374607431768211455':write('some day');
end;
writeln;
end;
writeln('Press enter to end . . .');
readln;
end.