On Wednesday, October 7, 2015 at 5:10:19 AM UTC-7, Barry Schwarz wrote:
> On Tue, 6 Oct 2015 13:19:15 CST, "Arthur Rubin
> (
ronni...@sprintmail.com)" <
arthur.r...@googlemail.com> wrote:
>
> >{ edited by mod to shorten lines to ~70 characters. -mod }
> >
> >I apologize if this has been asked before, but I can't find it in the
> >archives.
> >
> >Is there an implementation of an integer (or even unsigned integer)
> >bignum class where the decimal representation is available. I'm working
> >on a number representation puzzle (recreational mathematics), and doing
> >the problem by hand seems intractable.
>
> Didn't any of the sites google identified have what you needed? What
> are you looking for that was missing?
There are a lot of bignum implementations; but none that I have
found on google use the actual digits internally.
For example, the specific puzzle requires that, for the
square of a d-digit number, I pick up the 10^(d-1) and
10^d digits reasonably quickly. I know I _could_ use a
conventional bignum representation for X and use
(X / PowerOfTen[d-1]) % 100
but that seems inelegant and could cause problems if d gets to
be large. For the particular puzzle, I don't anticipate needing
d > 12, but it depends on the results.
For this specific problem, I might even be able to get by with
uint_128, but I'd rather not have to rewrite for more elaborate
problems.
--
Arthur Rubin
ronnirubin [at]
sprintmail.com
--