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=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.ada Subject: Re: Ada.Numerics.Big_Numbers.Big_Integer has a limit of 300 digits? Date: Wed, 22 Dec 2021 12:31:32 -0800 Organization: A noiseless patient Spider Message-ID: <87ilvgwfdn.fsf@nightsong.com> References: <304dcae2-8b20-43ff-8769-32fa06d4dc10n@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="dc08b31fa408c994b3052dbcf9f5a79a"; logging-data="6539"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19jnYoY9eLrdKHnxSTIW7+O" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) Cancel-Lock: sha1:5KETpuF5EJSdqHLSCzkAVCuEyvQ= sha1:m8CLy0sMtS1DXP10hbIZ+ZECL7Y= Xref: reader02.eternal-september.org comp.lang.ada:63247 List-Id: Michael Ferguson writes: > I am working on ProjectEuler.net problem number 48. ... > Obviously, this is quite a trivial problem when using any arbitrary > precision library. The thing about Euler problems is they usually want you to figure out a clever math trick to get to the solution, rather than using brute calculation. In the case of this problem, you want to reduce all the intermediate results mod 1e10 (which fits in an int64 easily, though not quite in an int32). That gets rid of the need for bignums.