[Number theory] knowledge

Multiplicative function

definition

If f (x) satisfies f (pq) = f (p) * f (q) and p⊥q, then f (x) is a multiplicative function.

Particularly, if required p⊥q, it was completely multiplicative function.

A nature

If n represents the factorization into prime factors (Fundamental Theorem of Arithmetic)

 

There are:

Two properties

If f is a multiplicative function and there     is f completely multiplicative function.

 

Prime numbers

Violence screen 

Violence miracle.

Erichsen screen

The idea is to find a prime number sieve out all its multiples.

Euler screen

Erichsen screen corresponding to an optimized, i.e., only the minimum number of prime factors of a bonded screen, the screen to avoid duplication.

const  int M = 1E8 + . 8 ;
 int Prime [M], CNT; // prime number table 
BOOL SS [M]; // I whether the prime 
inline void sushu () { 
    Memset (SS, to true , the sizeof (SS));
     for ( int I = 2 ; I <= M; I ++ ) {
         IF (SS [I]) Prime [++ CNT] = I;
         for ( int J = . 1 ; J <= CNT; J ++ ) {
             IF (I * Prime [J]> || M) (% Prime I [J]!) BREAK ; // mesh sieve end end & avoid repetition
            ss[i*prime[j]]=false;
        }
    }
    ss[1]=ss[0]=false;
} 
View Code

MIller-Rabin prime sieve

Decomposition quality factor

 

Guess you like

Origin www.cnblogs.com/jian-song/p/11619199.html