William F Hammond on Fri, 11 Dec 2015 00:26:35 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Regarding digits function


Karim Belabas <Karim.Belabas@math.u-bordeaux.fr> writes:

> Yes, our convention is that 0 has no digits.

I have gp scripts "rattovecs" and "vecstorat" that convert
back and forth between a positive rational number and the
sequence of three vectors, for a given base, consisting of
the digit vectors in the given base for the integer part,
the initial segment, and the cycle.  My opinion is that
there is indeed some arbitrariness in deciding between []
and [0].

I do think that [0] makes sense for the cycle, i.e.,
rattovecs(1/4) = [[],[2,5],[0]], because there is always a
positive cycle length emerging in the algorithm (given by
the repetition pattern in the sequence of remainders for
successive divisions by the denominator of the rational
number).  Otherwise I prefer [], and, in fact, rattovecs(N),
for any positive integer N, emits [] for the fractional
components.

But the reverse routine accommodates redundant 0's.

                                    -- Bill