## `numlib::g_adic` -- g-adic representation of a nonnegative integer

#### Introduction

If `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)`

#### Parameters

`par1` | - | an nonnegative integer
`par2` | - | an integer whose absolute value is greater then

#### Returns

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

#### Related Functions

`genpoly`, `int2text`, `text2int`

#### Details

- `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.

#### Example 1

Computing the dyadic representation of :

    >> numlib::g_adic(1994,2)

                         [0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1]

#### Example 2

Computing the hexadecimal representation of :

    >> numlib::g_adic(2001,16)

                                    [1, 13, 7]

#### Changes

- no changes

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000