From: "Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not>
Subject: Re: project euler 29
Date: Fri, 15 Sep 2023 11:50:42 +0200 [thread overview]
Message-ID: <ue19di$35ura$1@dont-email.me> (raw)
In-Reply-To: <beaa0494-5783-4130-b96f-1a5271466678n@googlegroups.com>
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
next prev parent reply other threads:[~2023-09-15 9:50 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-15 9:03 project euler 29 CSYH (QAQ)
2023-09-15 9:50 ` Jeffrey R.Carter [this message]
2023-09-15 18:04 ` Keith Thompson
2023-09-15 15:42 ` Ben Bacarisse
2023-09-16 10:07 ` Francesc Rocher
2023-09-16 20:59 ` Ben Bacarisse
2023-09-16 21:56 ` Ben Bacarisse
2023-09-17 18:56 ` Francesc Rocher
2023-09-17 22:54 ` Paul Rubin
2023-09-17 23:08 ` Ben Bacarisse
2023-09-18 0:09 ` Paul Rubin
2023-09-18 0:16 ` Ben Bacarisse
2023-09-18 5:16 ` Paul Rubin
2023-09-18 11:31 ` Ben Bacarisse
2023-09-18 13:04 ` Francesc Rocher
2023-09-18 14:20 ` Ben Bacarisse
2023-09-18 16:55 ` Francesc Rocher
2023-09-18 19:22 ` Ben Bacarisse
2023-09-18 19:38 ` Paul Rubin
2023-09-18 19:52 ` comp.lang.ada
2023-09-18 19:56 ` comp.lang.ada
2023-09-18 20:01 ` Ben Bacarisse
2023-09-15 16:34 ` Jeffrey R.Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox