随笔分类 -  数学——欧拉函数、定理等

摘要:可以发现, $$\displaystyle c^{c^{c^\cdots}}$$ 从下到上对应的模数是 $p,\varphi(p),\varphi(\varphi(p)),\varphi(\varphi(\varphi(p))),\ldots ,1,1$。(为什么有两个 $1$?一会儿再说) 因此当 阅读全文
posted @ 2018-03-14 19:54 poorpool 阅读(195) 评论(0) 推荐(0)
摘要:欲求 $\sum_{i=1}^n (i,n)$。 显然 $(i,n) \mid n$。记 $d=(i,n)$,枚举 $d$,有多少个 $i \in [1,n]$ 使得 $(i,n)=d$ 呢?换句话说有多少个 $i \in [1,\lfloor n/d \rfloor]$ 使得 $(i,\lfloo 阅读全文
posted @ 2018-03-12 16:48 poorpool 阅读(94) 评论(0) 推荐(0)
摘要:先筛法求出 $[1,n]$ 间的素数,然后枚举每个素数。可以发现,对于每个素数 $x$,它的贡献是 $[1,\lfloor n/x \rfloor]$ 间的有序互质对数。 我们钦定 $(x,y)$ 是 $x \leq y$ 的,发现 $x=y$ 是合法的当且仅当 $x=y=1$。这样就有 $x in 阅读全文
posted @ 2018-03-12 15:22 poorpool 阅读(130) 评论(0) 推荐(0)
摘要:即求出一个 $x$ 使得 $L|8 \times (10^x 1)/9$,记 $d=(L,8)$。 $$L|8 \times (10^x 1)/9 \Leftrightarrow \frac{9L}{d}|(10^x 1) \Leftrightarrow 10^x \equiv 1 \pmod {\ 阅读全文
posted @ 2018-03-05 09:19 poorpool 阅读(190) 评论(0) 推荐(0)
摘要:答案就是 $3+2 \times \sum_{i=2}^n \varphi(i)$,记得特判 cpp include include using namespace std; int n, T, phi[1005]; void shai(){ for(int i=1; i T; for(int i= 阅读全文
posted @ 2018-03-04 22:07 poorpool 阅读(112) 评论(0) 推荐(0)
摘要:我们想知道 $2^{2^{2^\cdots}}\mod p$。 考虑用扩展欧拉定理降幂, $$2^{2^{2^\cdots}}\equiv 2^{(2^{2^\cdots}\mod \varphi(p))+\varphi(p)}\mod p. $$ 于是定义$f(p)=2^{2^{2^\cdots} 阅读全文
posted @ 2017-12-29 10:01 poorpool 阅读(149) 评论(0) 推荐(0)
摘要:扩展欧拉定理: $$ a^x \equiv a^{x\mathrm{\ mod\ }\varphi(p) + x \geq \varphi(p) ? \varphi(p) : 0}(\mathrm{\ mod\ }p)$$ cpp include include include using name 阅读全文
posted @ 2017-12-28 21:58 poorpool 阅读(458) 评论(0) 推荐(0)
摘要:点 $ (i,j) $ 会看不见当有 $ k|i $ 且 $ k|j$ 时。 然后就成了求欧拉函数了。 cpp include include include using namespace std; int n, phi[40005], pri[40005], cnt; bool isp[4000 阅读全文
posted @ 2017-12-19 20:08 poorpool 阅读(146) 评论(0) 推荐(0)
摘要:hdu1787,直接求欧拉函数 poj2478,欧拉函数递推,证明可以看 "这里" 或者是算法竞赛进阶指南 $n \log n$ 筛 cpp include include include using namespace std; int n; long long phi[1000005]; voi 阅读全文
posted @ 2017-12-19 19:15 poorpool 阅读(171) 评论(0) 推荐(0)