function IntToBaseStr(n: longword; const b: cardinal): string;
const
digits = '0123456789abcdefghijklmnopqrstuvwxyz';
var
remainder: longword;
begin
Result := '';
repeat
DivMod(n, b, n, remainder);
result := digits[remainder + 1] + result;
until n = 0;
end;
def parse(value, base):
array = digits + ascii_lowercase
def f(value):
if value < base:
return array[value]
n, index = divmod(value, base)
return f(n) + array[index]
return f(value)
s = parse(n, b)
def int_to_base_str(n, b):
digits = '0123456789abcdefghijklmnopqrstuvwxyz'
s = ''
if n == 0: return '0'
while n:
n, remainder = divmod(n, b)
s = digits[remainder] + s
return s
array = digits + ascii_lowercase
def f(value):
if value < b:
return array[value]
value, index = divmod(value, b)
return f(value) + array[index]
s = f(n)
function IntToBaseStr(n: longword; const b: cardinal): string;
const
digits = '0123456789abcdefghijklmnopqrstuvwxyz';
var
remainder: longword;
begin
Result := '';
repeat
DivMod(n, b, n, remainder);
result := digits[remainder + 1] + result;
until n = 0;
end;
def int_to_base_str(n, b):
digits = '0123456789abcdefghijklmnopqrstuvwxyz'
s = ''
if n == 0: return '0'
while n:
n, remainder = divmod(n, b)
s = digits[remainder] + s
return s
array = digits + ascii_lowercase
def f(value):
if value < b:
return array[value]
value, index = divmod(value, b)
return f(value) + array[index]
s = f(n)