This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


G-adic representation of a nonnegative integer

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.


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?