numlib::g_adic
-- g-adic
representation of a nonnegative integerIf 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 .
numlib::g_adic(par1,par2)
par1 |
- | an nonnegative integer |
par2 |
- | an integer whose absolute value is greater then |
a list of nonnegative integers, or the function call with evaluated arguments if one of the arguments is not a number.
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.Computing the dyadic representation of :
>> numlib::g_adic(1994,2)
[0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1]
Computing the hexadecimal representation of :
>> numlib::g_adic(2001,16)
[1, 13, 7]