next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
TestIdeals :: adicExpansion

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 ith element is the coefficient of pi-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 ith 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 + …, 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 :