Macaulay2 » Documentation
Packages » TestIdeals :: adicExpansion
next | previous | forward | backward | up | index | toc

adicExpansion -- compute adic expansion

Synopsis

Description

adicExpansion(p, 0) returns \{0\}. If $N$ is nonzero, then adicExpansion(p, N) returns a list in which the $i^{th}$ element is the coefficient of $p^{i-1}$ in the base $p$ expansion of $N$.

i1 : 38 == 3*5^0 + 2*5^1 + 1*5^2

o1 = true
i2 : adicExpansion(5, 38)

o2 = {3, 2, 1}

o2 : List

adicExpansion(p, e, 0) returns a list with $e$ elements, all of which are zero. If $x$ is nonzero, then adicExpansion(p, e, x) returns a list with $e$ elements in which the $i^{th}$ element is the coefficient of $p^{-i}$ in the unique nonterminating base $p$ expansion of $x$. For example, the non-terminating base $3$ expansion of $1/5$ is $1/5 = 0/3 + 1/9 + 2/27 + 1/81 + 0/243 + 1/729 + \cdots$, and so adicExpansion(3, 6, 1/5) returns the digits $0$, $1$, $2$, $1$, $0$, and $1$.

i3 : adicExpansion(3, 6, 1/5)

o3 = {0, 1, 2, 1, 0, 1}

o3 : List

See also

Ways to use adicExpansion :

For the programmer

The object adicExpansion is a method function.