"Min_25 筛"

min25_ sieve is one kind of a method for obtaining fast multiplicative function of the sieve.


Its use has three conditions:
1. The multiplicative function must be
2. The form must be low-order polynomial
3. \ (P ^ J \) function value can be quickly obtained, not necessarily \ (O (. 1) \) .


first define \ (g (n, j) \) represents [1, n] minimum quality factor \ (> p_j \) or it is a prime number, one of two conditions are satisfied \ (I \) a \ (K ^ I \) (that part of a low order polynomial?) and.
\ (G (n-, J) = \ sum_ = {I}. 1 ^ n-[min \ P> p_j | I \ in P] I ^ K \)
\ (G (n-, 0) = \ SUM \ limits_ {I = 2} ^ Ni ^ K \)


, then transferred into \ (p_j 2 ^ <= n-\) , \ (^ 2 p_j> n-\) .
1. If \ (p_j ^ 2 \) > n-, it is impossible to satisfy a number of engagement \ (min \ P> p_j \) , so \ (G (n-, J) = G (n-,. 1-J) \)
2. \ (p_j ^ 2 \) <= n-.
from \ (g (n, j- 1) \)Move to the \ (g (n, j) \) loss must be (min \ p == p_j \) \ a function of the number of those values.
\ (G (n-, J) = G (n-,. 1-J) -p_j ^ k (g (\ frac
{n} {p_j}, j-1) - \ sum \ limits_ {i = 1} ^ {j-1} p_i ^ k) \) so
\ [g (n, j ) = \ begin {cases} g (n, j-1) & p_j ^ 2> n \\ g (n, j-1) -p_j ^ k (g (\ frac {n} {p_j}, j-1) - \ SUM \ limits_ {I =. 1} ^ {J-. 1} P_i ^ K) & p_j ^ 2 <= n-\\ \ End {Cases} \]
. when the value of the prefix and may be linear sieve prime function as perform
discovery g the second dimension is constant, a dimension can be omitted.


Next, define the \ (S (n-, J) \)
\ (S (n-, J) = \ SUM \ limits_. 1} ^ {n-I = [min \ p> = p_j] f (
i) \) transfer discussions prime and non-prime number.
\ [S (n-, J) = (othersF) * (G (n-, | P |) - \ SUM \ limits_ {I = 1} ^ {j-1 } p_i ^ k) + \ sum \ limits_ {k> = j} ^ {p_k ^ 2 <= n} \ sum \ limits_ {e = 1} ^ {p_k ^ {e + 1 } <= n} (F (
p_k ^ e) S (\ frac {n} {p_k ^ e}, k + 1) + F (p_k ^ {e + 1})) \] explanation.
first, all the function value of the number of legal quality for it.
Since just out function g \ (i ^ k \)And all the prime numbers, so if this multiplicative function also includes other things but also to take it up.
Followed by the value of the legal function together.
Enumeration k as the smallest prime factor then enumerated a power times.
Because It can be a direct product of F * S.
plus a \ (F (p_k ^ {e + 1}) \) is not due to the quality of a house due to the stuff.
so for \ (p_k ^ e (e> 1) \ ) is directly blown away.
so to add \ (F. (P_K E ^ {+}. 1) \) .
Why \ (e + 1 \) , because the \ (p ^ 1 \) as the prime has were calculated.


lot of small details:
1. because the formulas appearing push \ (p_j ^ 2 <= n \) properties, so that the two functions need only \ (\ sqrt n \) primes treated .
2. because all used and g subscripts are S \ (\ frac {n} { ...} \) form, so that only the \ (\ sqrt n \) optional values.
3. in g omitted when evaluated first dimension to the second dimension need descending enumeration, since exactly divisible block in descending order so direct-positive enumerated.
4.G function is wilt ... because we only seek answers primes with it, I do not know if there is an answer numbers in the ...
5.g function can be calculated as a whole answer F.
But only the initial value becomes \ (F. (I) \)
\ (G (n-, J) = G (n-,. 1-J) - p_j ^ k (g (\ frac {n} {p_j}, j-1) - \ sum \ limits_ {i = 1} ^ {j-1} p_i ^ k) \) of \ (p_j ^ k \) and not become \ (F (p_j ^ k) \) .
(This is cow's mouth Hu)
6.g initializer is not a natural number and power, 2 from the start.

Guess you like

Origin www.cnblogs.com/hzoi2018-xuefeng/p/12381436.html