<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>线性筛 on Zirnc's Blog</title><link>https://blog.chungzh.cn/blog/%E7%BA%BF%E6%80%A7%E7%AD%9B/</link><description>Recent content in 线性筛 on Zirnc's Blog</description><generator>Hugo -- gohugo.io</generator><language>zh-cn</language><lastBuildDate>Sat, 01 Apr 2023 00:00:00 +0000</lastBuildDate><atom:link href="https://blog.chungzh.cn/blog/%E7%BA%BF%E6%80%A7%E7%AD%9B/index.xml" rel="self" type="application/rss+xml"/><item><title>欧拉函数笔记</title><link>https://blog.chungzh.cn/oi-history/euler/</link><pubDate>Sat, 01 Apr 2023 00:00:00 +0000</pubDate><guid>https://blog.chungzh.cn/oi-history/euler/</guid><description>定义 欧拉函数 $\varphi(n)$ 表示小于等于 $n$，且与 $n$ 互质的正整数的个数。
如何求 $\varphi(n)$？
比如 $varphi(12)$ 把 $12$ 质因数分解，$12=2^2*3$，其实就是得到了 $2$ 和 $3$ 两个互异的质因子。
然后把 $2$ 的倍数和 $3$ 的倍数都删掉。
$2$ 的倍数：$2,4,6,8,10,12$
$3$ 的倍数：$3,6,9,12$
但是是 $6$ 和 $12$ 重复减了。所以还要把既是 $2$ 的倍数又是 $3$ 的倍数的数加回来。所以这样写：$12 - 12/2 - 12/3 + 12/(2*3)$。运用了容斥原理。
性质 欧拉函数是积性函数。
积性是什么意思呢？如果有 $\gcd(a, b) = 1$，那么 $\varphi(a \times b) = \varphi(a) \times \varphi(b)$。
特别地，当 $n$ 是奇数时 $\varphi(2n) = \varphi(n)$。
$n = \sum_{d \mid n}{\varphi(d)}$。</description></item></channel></rss>