Euler函數(shù):
m = p1^r1 * p2^r2 * …… * pn^rn ai >= 1 , 1 <= i <= n
Euler函數(shù):
定義:phi(m) 表示小于等于m并且與m互質(zhì)的正整數(shù)的個數(shù)。
phi(m) = p1^(r1-1)*(p1-1) * p2^(r2-1)*(p2-1) * …… * pn^(rn-1)*(pn-1)
= m*(1 - 1/p1)*(1 - 1/p2)*……*(1 - 1/pn)
= p1^(r1-1)*p2^(r2-1)* …… * pn^(rn-1)*phi(p1*p2*……*pn)
定理:若(a , m) = 1 則有 a^phi(m) = 1 (mod m) 即a^phi(m) - 1 整出m
在實(shí)際代碼中可以用類似素數(shù)篩法求出
for (i = 1 i < MAXN i++)
phi[i] = i
for (i = 2 i < MAXN i++)
if (phi[i] == i)
{
for (j = i j < MAXN j += i)
{
phi[j] /= i
phi[j] *= i - 1
}
}
容斥原理:定義phi(p) 為比p小的與p互素的數(shù)的個數(shù)
設(shè)n的素因子有p1, p2, p3, … pk
包含p1, p2…的個數(shù)為n/p1, n/p2…
包含p1*p2, p2*p3…的個數(shù)為n/(p1*p2)…
phi(n) = n - sigm_[i = 1](n/pi) + sigm_[i!=j](n/(pi*pj)) - …… +- n/(p1*p2……pk)
= n*(1 - 1/p1)*(1 - 1/p2)*……*(1 - 1/pk)
標(biāo)簽:
Euler
lt
phi
函數(shù)
上傳時間:
2014-01-10
上傳用戶:wkchong
Fully revised to cover the latest standards and technologies, XML and Java(TM), Second Edition provides the practical solutions developers need to design powerful and portable Web-based applications. Featuring step-by-step examples, this book focuses on harnessing the power of Java(TM) and XML together to streamline the development process.
XML and Java(TM), Second Edition provides new coverage of emerging areas such as document management, databases, messaging, servlets, JDBC, data binding, security, and more. It begins with an overview of XML programming techniques, standard APIs, and tools. Building upon this foundation, the book goes on to cover the latest technologies, including DOM Level 2, SAX2, XSLT, SOAP, WSDL, and UDDI. It explores the role of these major middleware technologies in XML and Java-based Web application development, as well as the limitations and potential pitfalls.
標(biāo)簽:
technologies
and
standards
Edition
上傳時間:
2014-01-05
上傳用戶:hj_18