[CLN-list] Questions?

Richard B. Kreckel kreckel at ginac.de
Thu Jun 1 23:23:59 CEST 2006


Hi!

Wilson Castro wrote:

>void squarefree_descomposition( cl_I n )
>{
>    bool bNegative;
>    cl_I raiz;
>    if( n < 0 )
>        bNegative = true;
>    else
>        bNegative = false;
>    
>    if( bNegative )
>        n = -n; 
>    
>    if( cln::isprobprime( n ) )
>    {
>        cout << n << " is quadrat frei " << "-- if( cln::isprobprime( n ) ) -- 
>" << endl;
>  
>

You mean to print " is prime ", here.

[...]

>QUESTIONS:
>
>1. because if the length of the two last calls are equal (length (n) = 15), 
>the times reported by “CL_TIMING” are different?
>  
>

That is a measurement error. By repeating the computation you may evolve 
a feeling for its magnitude.

>it seems to me that the complexity of my   approach depends on the primality 
>test of n. 
>  
>

Well, it certainly depends on the outcome of the primality test because 
if isprobprime(n) returns true, the rest of the loop is cut short. :)

But, seriously: The time spent inside isprobprime(n) is negligible 
compared with the time that goes into your loop running all the way from 
isqrt(n) down to two.

>2. There is some limitation in the length of the algument n in the function
>"cl_boolean isprobprime (const cl_I& n)"?
>  
>

Well, sure, but its very much larger that what you can trigger in that 
experiment.

Regards
-richy.

-- 
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>



More information about the CLN-list mailing list