function IntToX(AValue,x:Integer):string;
var i:Integer;
begin
Result:='';
i:=AValue;
repeat
Result:=IntToStr(i mod x)+Result;
i:=i div x
until i=0;
end;
function IntToBin(AValue:Integer):string;
var i:Integer;
begin
Result:='';
i:=AValue;
repeat
Result:=IntToStr(i mod 2)+Result;
i:=i div 2
until i=0;
end;