Re: [fpc-pascal]isprime()

2003-02-11 Thread astlab
I've revised isprime(), now it is a bit faster. The new version embedded in a small unit can be found at: http://www.polarhome.com/~franco/isprime.pas Franco ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-

Re: [fpc-pascal]isprime()

2003-02-09 Thread astlab
Hi Mark > Just out of curiosity, is Franco's algorithm based upon the recent > discovery by mathematicians in India? No, the method of Agrawal, Kayal and Saxena is still in a theoretical state and we have to wait for an efficient algorithm to apply it. I used an old Miller-Rabin method. By testin

Re: [fpc-pascal]isprime()

2003-02-09 Thread astlab
Hi Anton > To me it seems that your function works properly. I compared the > results for all cardinal values, using your algorithm > (cprimes_v.create below) against the results of my own algorithm > (cprimes_m.create below), which I updated to 32 bits tonight. I'm happy to read that the functio

Re: [fpc-pascal]isprime()

2003-02-09 Thread Mark Emerson
> whereas you analytically check one single > number for primality. Just out of curiosity, is Franco's algorithm based upon the recent discovery by mathematicians in India? Mark ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/

Re: [fpc-pascal]isprime()

2003-02-09 Thread Anton Tichawa
Hi, Franco Milani! To me it seems that your function works properly. I compared the results for all cardinal values, using your algorithm (cprimes_v.create below) against the results of my own algorithm (cprimes_m.create below), which I updated to 32 bits tonight. All I changed in your function

Re: [fpc-pascal]isprime()

2003-02-07 Thread astlab
Hi Anton :) > Does the function return false for 0 and 1? Yes > How easy isit to upgrade for > 64 bit lengths? Indeed, isprime() is part of a routine working with the 'nat' big numbers of the unit bigint10. Its purpose is to perform a primality check by a strong test to the base 2 and a Lucas t

Re: [fpc-pascal]isprime()

2003-02-07 Thread Anton Tichawa
Hello, List! > I made a function of 116 lines in assembler: > > isprime(n: cardinal): boolean; Sounds good. > which returns true if a cardinal is prime, false otherwise. > The routine is fast and uses only an array of 18 cardinals and six > cardinals as local variables. Obviously it may be used

[fpc-pascal]isprime()

2003-02-07 Thread astlab
I made a function of 116 lines in assembler: isprime(n: cardinal): boolean; which returns true if a cardinal is prime, false otherwise. The routine is fast and uses only an array of 18 cardinals and six cardinals as local variables. Obviously it may be used by an external unit, anyhow let me know