From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,69bb03cc695b330a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-17 01:38:52 PST Path: nntp.stanford.edu!newsfeed.stanford.edu!news.tele.dk!129.240.148.23!uio.no!nntp.uib.no!georg From: georg@ii.uib.no (Hans Georg Schaathun) Newsgroups: comp.lang.ada Subject: Re: Modular type (Re: Large numbers) Date: 15 Mar 2001 11:12:45 GMT Organization: University of Bergen Message-ID: References: <3AA95244.94BAD60D@averstar.com> <87itlbnvrh.fsf@deneb.enyo.de> NNTP-Posting-Host: apal.ii.uib.no X-Trace: toralf.uib.no 984654765 59498 129.177.16.7 (15 Mar 2001 11:12:45 GMT) X-Complaints-To: abuse@uib.no NNTP-Posting-Date: 15 Mar 2001 11:12:45 GMT User-Agent: slrn/0.9.5.6 [hacked] (UNIX) Xref: nntp.stanford.edu comp.lang.ada:91476 Date: 2001-03-15T11:12:45+00:00 List-Id: On 15 Mar 2001 11:58:58 +0100, Florian Weimer wrote: : If you want to calculate the inverse of $x \in (\Z/n\Z)^\times$, : you can use that $x^{\phi(n)}$ equals $1$, so you need only : $O(\log \phi (n))$ operations. Ooops, sure. Sorry, I should have thought of that by myself. Thx. : (To calculate $\phi(n)$, you need the : factorization of $n$, which is quite expensive, but needed only once). Usually rather simple for prime numbers though, and I only want prime moduli :-) : > Is it in any way possible to choose the modulus for a modular type : > runtime, e.g. by parameter to the program? : : No, there isn't. The modulus has to be a static expression (which is : a stronger requirement then a compile-time constant). I wonder why this is necessary. Is there an efficiency gain from using built-in modular type compared to defining ones own modular type with a run-time parameter as modulus? (Assuming prime modulus.) :-- Hans Georg -- Signature en panne.