numlib::g_adic -- g-adic
representation of a nonnegative integer
IntroductionIf a is a natural number and g is an
integer such that numlib::g_adic(a,g)
returns the g-adic representation of a as a
list such that a = a_0 + a_1*g +
a_2*g^2 + ...+ a_r*g^r and für and .
Call(s)numlib::g_adic(par1,par2)
Parameterspar1 |
- | an nonnegative integer |
par2 |
- | an integer whose absolute value is greater then |
Returnsa list of nonnegative integers, or the function call with evaluated arguments if one of the arguments is not a number.
Related
Functions
Detailsnumlib::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.
Example
1Computing the dyadic representation of :
>> numlib::g_adic(1994,2)
[0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1]
Example
2Computing the hexadecimal representation of :
>> numlib::g_adic(2001,16)
[1, 13, 7]