From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.5 required=3.0 tests=BAYES_05,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.6 X-Received: by 2002:a05:620a:25ca:: with SMTP id y10mr2994685qko.526.1640201208495; Wed, 22 Dec 2021 11:26:48 -0800 (PST) X-Received: by 2002:a05:6902:727:: with SMTP id l7mr6317833ybt.115.1640201208315; Wed, 22 Dec 2021 11:26:48 -0800 (PST) Path: eternal-september.org!reader02.eternal-september.org!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 22 Dec 2021 11:26:48 -0800 (PST) In-Reply-To: <304dcae2-8b20-43ff-8769-32fa06d4dc10n@googlegroups.com> Injection-Info: google-groups.googlegroups.com; posting-host=131.164.234.134; posting-account=Srm5lQoAAAAEMX9rv2ilEKR6FDPapmSq NNTP-Posting-Host: 131.164.234.134 References: <304dcae2-8b20-43ff-8769-32fa06d4dc10n@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Ada.Numerics.Big_Numbers.Big_Integer has a limit of 300 digits? From: Mark Lorenzen Injection-Date: Wed, 22 Dec 2021 19:26:48 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:63246 List-Id: On Wednesday, December 22, 2021 at 6:27:57 PM UTC+1, Michael Ferguson wrote= : > On Wednesday, December 22, 2021 at 11:02:03 AM UTC-6, Luke A. Guest wrote= :=20 > > On 22/12/2021 05:57, Michael Ferguson wrote:=20 > > > I just started using the Big_Integer library that is a part of the 20= 2X version of ADA.=20 > > >=20 > > > It is repeatedly described as an "arbitrary precision library" that h= as user defined implementation.=20 > > >=20 > > > I was under the impression that this library would be able to infinit= ely calculate numbers of any length, but there is clearly a default limit o= f 300 digits.=20 > > What are you doing that requires that number of digits? > I am working on ProjectEuler.net problem number 48.=20 >=20 > The questions asks you to sum the numbers n^n for (2 <=3D n <=3D 1000) an= d determine what the last ten digits of this number are.=20 Interesting. Assume that the problem is related to the maximum size of lexi= cal elements, can't you then use the "rem" function from Big_Integers to de= termine the last 10 digits e.g. by something like this Last_10_Digits =3D M= y_Very_Large_Number rem To_Big_Integer(1) ** 10? This should give you a value of type Valid_Big_Integer consisting of up to = ten digits that you can obtain the integer representation of. Regards, Mark L