Function: digits
Section: conversions
C-Name: digits
Prototype: GDG
Help: digits(x,{b}): gives the vector formed by the digits of x in base b.
Doc:
 outputs the vector of the digits of $|x|$ in base $b$, where $x$ and $b$ are
 integers ($b = 10$ by default), from most significant down to least
 significant. For $x\ge1$, the number of digits is
 $\kbd{logint}(x,b) + 1$. See \kbd{fromdigits} for the reverse operation.

 We also allow $x$ an integral $p$-adic in which case $b$ should be omitted
 or equal to $p$. Digits are still ordered from most significant to least
 significant in the $p$-adic sense (meaning we start from $x$ mod $p$);
 trailing zeros are truncated.
 \bprog
 ? digits(1230)
 %1 = [1, 2, 3, 0]

 ? digits(10, 2) \\ base 2
 %2 = [1, 0, 1, 0]
 @eprog\noindent By convention, $0$ has no digits:
 \bprog
 ? digits(0)
 %3 = []
 ? 1105 + O(5^5)
 %4 = 5 + 4*5^2 + 3*5^3 + O(5^5)
 ? digits(%)
 %5 = [0, 1, 4, 3]
 @eprog
