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=-3.2 required=3.0 tests=BAYES_00,NICE_REPLY_A, 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: "Jeffrey R.Carter" Newsgroups: comp.lang.ada Subject: Re: project euler 29 Date: Fri, 15 Sep 2023 11:50:42 +0200 Organization: A noiseless patient Spider Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 15 Sep 2023 09:50:42 -0000 (UTC) Injection-Info: dont-email.me; posting-host="0e274621ec3606d81273a7f3bf7ecc67"; logging-data="3341162"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+IJT1A2pOLs0vyM0spXpuVi1E7o5ovgyU=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Cancel-Lock: sha1:FJdnn0hpxHeLK4n0ME2a0imZxxU= Content-Language: en-US In-Reply-To: Xref: news.eternal-september.org comp.lang.ada:65658 List-Id: On 2023-09-15 11:03, CSYH (QAQ) wrote: > > for this problem I want to know how to know is there an easy way to store a large number like 100 ** 100, and how do U make a similar function like "set(context)" to delete the duplicated value in a vector. You will need an unbounded-integer pkg. If you want to write portable code in a standard language, then you can write Ada 12 using a library such as PragmARC.Unbounded_Numbers.Integers (https://github.com/jrcarter/PragmARC/blob/Ada-12/pragmarc-unbounded_numbers-integers.ads). This will compile with both GNAT and ObjectAda. If you want to write non-portable code in a non-standard, Ada-like language, then you can use the GNAT language, which is mostly Ada 12 with some Ada 23 features, one of which is the Ada-23 standard package Ada.Numerics.Big_Numbers.Big_Integers (http://www.ada-auth.org/standards/22aarm/html/AA-A-5-6.html). This can only be compiled with GNAT. Note that, unlike PragmARC.Unbounded_Numbers.Integers, GNAT's implementation of Ada.Numerics.Big_Numbers.Big_Integers is not truly unbounded. I don't know if it will hold 101 ** 101 without modification. You can store the results directly in a set from the standard library to avoid duplicate values. If I understand your Python (probably not), you would want to output the result of Length for the resulting set. -- Jeff Carter "I didn't squawk about the steak, dear. I merely said I didn't see that old horse that used to be tethered outside here." Never Give a Sucker an Even Break 103