isprime                 package:gmp                 R Documentation

_D_e_t_e_r_m_i_n_e _i_f _n_u_m_b_e_r _i_s _p_r_i_m_e

_D_e_s_c_r_i_p_t_i_o_n:

     Determine whether the number is prime or not. 2: number is prime,
     1, number is probably prime (without beeing certain), 0 number is
     composite.

_U_s_a_g_e:

     isprime(n, reps = 40)  

_A_r_g_u_m_e_n_t_s:

       n: Integer number, to be tested

    reps: Integer, number of repeats 

_D_e_t_a_i_l_s:

     This function does some trial divisions, then some Miller-Rabin
     probabilisticprimary tests. reps controls how many such tests are
     done, 5 to 10 is a resonable number. More will reduce the chances
     of a composite being returned as "probably prime".

_V_a_l_u_e:

       0: Number is not prime

       1: Number is probably prime

       2: Number is prime

_A_u_t_h_o_r(_s):

     Antoine Lucas

_R_e_f_e_r_e_n_c_e_s:

     Gnu MP Library see http://swox.com/gmp

_S_e_e _A_l_s_o:

     'nextprime'

_E_x_a_m_p_l_e_s:

     isprime(210)
     isprime(71)

     # All primes numbers from 1 to 100
     t <-isprime(1:100)
     (1:100)[t>0]

