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=-1.9 required=3.0 tests=BAYES_00,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.ada Subject: Re: project euler 29 Date: Sun, 17 Sep 2023 22:16:33 -0700 Organization: A noiseless patient Spider Message-ID: <87v8c8oyby.fsf@nightsong.com> References: <874jjvmoi9.fsf@bsb.me.uk> <87sf7dltq0.fsf@bsb.me.uk> <87jzsplr49.fsf@bsb.me.uk> <715fe49a-47bc-46be-ae26-9ed89b38bcb5n@googlegroups.com> <87ediwl7oq.fsf@bsb.me.uk> <87zg1kpcjh.fsf@nightsong.com> <8734zcl4j0.fsf@bsb.me.uk> MIME-Version: 1.0 Content-Type: text/plain Injection-Info: dont-email.me; posting-host="02e6da0e6d12432512a57a13e6ebb466"; logging-data="856656"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18kIUl2vZyFvD1RkYit7OEW" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) Cancel-Lock: sha1:RAJXe15tR8eVhqg4P40N11IVZ0k= sha1:GjXiCpraLX7YjQRWtghpIYTbFQs= Xref: news.eternal-september.org comp.lang.ada:65674 List-Id: Ben Bacarisse writes: >> So you just loop through 1 <= a,b <= 100 and count only the a,b pairs >> where a is the smallest a for its equivalence class. > This is likely to be fast which is why I wanted to compile Francesc's to > try it out. Mind you, a naive a^b == c^d test gives pretty good > performance for the kind of range requested. But Francesc's program doesn't use that method. It only suggests it in a comment. The program actually works by building a list, sorting it, and counting the groups.