base - Maple Help

convert/base

convert between bases

 Calling Sequence convert(n, 'base', $\mathrm{\beta }$) convert(L, 'base', $\mathrm{\alpha }$, $\mathrm{\beta }$)

Parameters

 n - integer; number to be converted L - list(nonnegint); digits of the base-$\mathrm{\alpha }$ number to be converted to base-$\mathrm{\beta }$ $\mathrm{\alpha }$ - posint; base of the input number, whose base-$\mathrm{\alpha }$ digits are given in L (least significant first) $\mathrm{\beta }$ - posint; output base

Description

 • convert/base converts the base-10 integer n to base-$\mathrm{\beta }$ or converts the list of integers L from base-$\mathrm{\alpha }$ to base-$\mathrm{\beta }$, in which case we interpret L as the number $\sum _{k=1}^{\mathrm{nops}\left(L\right)}{L}_{k}{\mathrm{\alpha }}^{k-1}$.  It is assumed that $0\le {L}_{k}<\mathrm{\alpha }$.
 • The result is a list of the base-$\mathrm{\beta }$ digits of the converted input.

Examples

Convert numbers in base 10 to any other base. The answer will be given in reverse order (least significant digit first).

 > $\mathrm{convert}\left(32,\mathrm{base},16\right)$
 $\left[{0}{,}{2}\right]$ (1)

The decimal number 17 written in base 3 is 122.

 > $\mathrm{convert}\left(17,\mathrm{base},3\right)$
 $\left[{2}{,}{2}{,}{1}\right]$ (2)

Convert the number 122 in base 3 to base 10. The number to be converted must be entered as a list in reverse order unless it is in base 10. The answer will be given in reverse order.

 > $\mathrm{convert}\left(\left[2,2,1\right],\mathrm{base},3,10\right)$
 $\left[{7}{,}{1}\right]$ (3)

Convert between different bases. The first number after base must be the base in which the number in brackets is given.

 > $\mathrm{convert}\left(\left[0,0,0,1\right],\mathrm{base},2,8\right)$
 $\left[{0}{,}{1}\right]$ (4)
 > $\mathrm{convert}\left(\left[0,1\right],\mathrm{base},8,16\right)$
 $\left[{8}\right]$ (5)
 > $\mathrm{convert}\left(\left[0,2\right],\mathrm{base},16,2\right)$
 $\left[{0}{,}{0}{,}{0}{,}{0}{,}{0}{,}{1}\right]$ (6)
 > $\mathrm{convert}\left(\left[0,2\right],\mathrm{base},16,32\right)$
 $\left[{0}{,}{1}\right]$ (7)