convert {
if ($2 > $3) {
echo -a So $2 is bigger than $3 $+ , converting $1 in base $2 to base $3 $+ .
if (. isin $calc($1 / $3)) {
var %digit = $gettok($calc($1 / $3),1,46)
var %remainder = . $+ $gettok($calc($1 / $3),2,46)
%remainder = $calc(%remainder * $3)
set %n 1
while (%digit > 0) {
var %digit = $gettok($calc(%digit / $3),1,46)
inc %n
var $eval($+(%,remainder,%n)) = . $+ $gettok($calc(%digit / $3),2,46)
var $eval($+(%,remainder,%n)) = $calc($eval($+(%,remainder,%n),2) * $3)
var %remainder = $addtok(%remainder,$eval($+(%,remainder,%n),2),32)
}
}
if (. !isin $calc($1 / $3)) {
var %remainder = 0
}
}
echo -a %remainder
;Then echo -a $wordreverse(%remainder)
}