G-adic representation of a nonnegative integer

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.


numlib::g_adic(number, base)


numlib::g_adic(0, g) returns [0].

numlib::g_adic returns an error if the arguments evaluate to numbers which are not both of the correct type.

If a is a natural number and g is an integer such that |g| > 1, numlib::g_adic(a, g) returns the g-adic representation of a as a list [a0, …, ar] such that

and 0 ≤ ai < |g| für i = 0, …, r - 1 and 0 < ar < |g|.


Example 1

Computing the dyadic representation of 1994:

numlib::g_adic(1994, 2)

Example 2

Computing the hexadecimal representation of 2001:

numlib::g_adic(2001, 16)



An nonnegative integer


An integer with absolute value is greater than 1

Return Values

List of nonnegative integers, or the function call with evaluated arguments if one of the arguments is not a number.

See Also

MuPAD Functions

Was this topic helpful?