<DIV><FONT size=5>
<P>To GMP Discussions Group (gmp-discuss@swox.com</FONT><FONT face=CMTT10 size=3>)</P>
<P>&nbsp;</P>
<P>Permit me to make&nbsp;three technical remarks about the following GMP functions: </P></FONT><FONT face=Arial size=2>
<P>A) I'll appreciate so much (and I suppose that many other GMP users too) to have a little "demo" program showing how one can use the </FONT><B><FONT face="Times New Roman"><FONT size=3>procedure mpz_array_init (Dest: mpz_array_ptr; ArraySize, FixedNumBits: mp_size_t); asmname '__gmpz_array_init'; </FONT></B></FONT><FONT face=Arial size=2>in GNU Pascal (my main doubt is in relation to mpz_array_ptr).</P>
<P>B) Moreover, how to use <B>mpz_inp_raw</B> and <B>mpz_out_raw, </B>also in GNU Pascal since they use C file pointers:</P>
<P>&nbsp;</P></FONT><FONT face="Times New Roman">
<P>{$if False} { @@ commented out because they use C file pointers } function mpz_inp_str (var Dest: mpz_t; Src: CFilePtr; Base: Integer): SizeType; asmname '__gmpz_inp_str'; <B>function mpz_inp_raw </B>(var Dest: mpz_t; Src: CFilePtr): SizeType ; asmname '__gmpz_inp_raw'; function mpz_out_str (Dest: CFilePtr; Base: Integer; protected var Src: mpz_t): SizeType; asmname '__gmpz_out_str'; <B>function mpz_out_raw </B>(Dest: CFilePtr; protected var Src: mpz_t): SizeType ; asmname '__gmpz_out_raw'; { @@ mpf_out_str has a bug in </FONT><FONT face="Times New Roman" color=#ffffff>GMP</FONT><FONT face="Times New Roman"> 2.0.2: it writes a spurious #0 before the exponent for negative numbers } function mpf_out_str (Dest: CFilePtr; Base: Integer; NumberOfDigits: SizeType; protected var Src: mpf_t): SizeType; asmname '__gmpf_out_str'; function mpf_inp_str (var Dest: mpf_t; Src: CFilePtr; Base: Integer): SizeType; asmname '__gmpf_inp_str'; {$endif} </P></FONT><FONT face=Arial size=2>
<P>C) At last, I would like to make a comment about the </FONT><B><FONT size=3><FONT face="Times New Roman">[Function] int mpz_probab_prime_p (mpz t n, int reps) </FONT></B><FONT face="Times New Roman">which determines whether n is prime. It returns 2 if n is definitely prime, returns 1 if n is probably prime (without being certain), or returns 0 if n </FONT></FONT><FONT face=CMR10><FONT face="Times New Roman" size=3>is definitely composite.</FONT></P>
<P><FONT size=3>This function does some trial divisions (for primes &lt;=???), then some Miller-Rabin probabilistic primality tests. </FONT></FONT><FONT size=3><FONT face=CMSL10>reps </FONT><FONT face=CMR10>controls how many such tests are done, 5 to 10 is a reasonable number, more will reduce the chances of a composite being returned as "probably prime".</P></FONT></FONT><FONT face=Arial size=2></FONT><FONT face=CMR10 size=3>
<P>Miller-Rabin and similar tests can be more properly called compositeness tests. Numbers which fail are known to be composite but those which pass might be prime or might be composite. Only a few composites pass, hence those which pass are considered probably prime.</P></FONT><FONT face=Arial size=2>
<P>&nbsp;</P>
<P>But, from the Elementary Number Theory, it is so known that the Rabin-Miller test can assert <B>WITH CERTAINTY</B> <I>the compositeness or primality of any natural number less than 341,550,071,728,321 </I>(by testing ONLY the seven prime bases 2,3,5,7,11,13,and 17). So, why this function does not apply these simple criteria? For example, for the prime 2^32-5=4,294,967,291, it returns 1 when it could return 2. </P>
<P>Thanks in advance for your kind consideration about. </P>
<P></P></FONT></DIV><BR><BR>Eng. Raul Nunes <br>NEST Newsy Echoes on Science and Technology <br><br>NEST presents the latest headlines on more than 300 different subjects,  harvested from near 2500 news sources and, above all, updated nearly  every 15 minutes.  Standard Headlines emphasize the sci-tech matters, while Personal Headlines permits customized specifications according to user's preferences.  Enjoy it!  CLICK HERE http://geocities.yahoo.com.br/raulnunes/<p>
                <hr size=1>Yahoo! Mail Mobile<br> 
<a href="http://us.rd.yahoo.com/evt=31132/*http://mobile.yahoo.com/learn/mail">Take Yahoo! Mail with you!</a> Check email on your mobile phone.