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-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.0 required=3.0 tests=BAYES_40,FREEMAIL_FROM, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Received: by 2002:ad4:57c4:0:b0:64a:742c:dcbd with SMTP id y4-20020ad457c4000000b0064a742cdcbdmr94021qvx.1.1694858827231; Sat, 16 Sep 2023 03:07:07 -0700 (PDT) X-Received: by 2002:a05:6808:13c6:b0:3a8:7543:ca00 with SMTP id d6-20020a05680813c600b003a87543ca00mr1756806oiw.5.1694858827026; Sat, 16 Sep 2023 03:07:07 -0700 (PDT) Path: eternal-september.org!news.eternal-september.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 16 Sep 2023 03:07:06 -0700 (PDT) In-Reply-To: <874jjvmoi9.fsf@bsb.me.uk> Injection-Info: google-groups.googlegroups.com; posting-host=77.75.179.3; posting-account=ZswU3AoAAAA4QKiyoxEpA3Hh7ry7Cau3 NNTP-Posting-Host: 77.75.179.3 References: <874jjvmoi9.fsf@bsb.me.uk> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: project euler 29 From: Francesc Rocher Injection-Date: Sat, 16 Sep 2023 10:07:07 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Bytes: 1995 Xref: news.eternal-september.org comp.lang.ada:65663 List-Id: El dia divendres, 15 de setembre de 2023 a les 17:42:43 UTC+2, Ben Bacarisse va escriure: > "CSYH (QAQ)" writes: > > > Now this time, I am facing trouble for problem #29. As I know integer > > type is for 32 bits. but for this problem as me to find out the 2 ** > > 100 and even 100 ** 100. I used python to get the answer correctly in > > 5 minutes. > Most of the Project Euler problems have solutions that are not always > the obvious one (though sometimes the obvious one is the best). You > can, of course, just use a big number type (or write your own!) but this > problem can be solved without having to use any large numbers at all. Please take a look at this solution: https://github.com/rocher/alice-project_euler-rocher/blob/main/src/0001-0100/p0029_distinct_powers.adb It's not using any big numbers library. --- Francesc Rocher