推导 & 证明

# 定理

# 威尔逊定理变式:x{(p,n)=1}x±1(modn)\prod\limits_{x\in\{(p,n)=1\}}x\equiv\pm1(mod\;n)

ThoughtsThoughts SolutionSolution
问题转化 求证小n且与n互质的数的乘积模 nn 一定为 111-1
因为是乘积,又与1有关,所以想逆元 x2≢1(modn)x^2\not\equiv1(mod\;n)
xinv(x)x\neq inv(x)x\therefore\;xinv(x)inv(x) 在数组中成对出现且乘积贡献为1
特殊情况处理 x21(modn)x^2\equiv1(mod\; n)
x=inv(x)x=inv(x)
但同时 (nx)2=n2nx+x2x21(modn)(n-x)^2=n^2-nx+x^2\equiv x^2\equiv1(mod\;n)
\thereforenx=inv(nx)\;n-x=inv(n-x)
在此时 xxnxn-x 也独立成对出现,乘积贡献为x(nx)=nxx21(modn)\boxed{x(n-x)=nx-x^2\equiv-1(mod\;n)}-1
得出结论 在小于 nn 且与 nn 互质的数中,会产生若干对数
它们的乘积要么是 11 要么是 1-1
所以累乘是 111-1

# 和差化积:sin(α±β)andcos(α±β)\sin(\alpha\pm\beta)\;and\;\cos(\alpha\pm\beta)

ThoughtsThoughts SolutionSolution
首先先证明sin(α+β)\sin(\alpha+\beta) SABC=SABD+SBDCabsin(α+β)=acsinα+bcsinβsin(α+β)=cbsinα+casinβsin(α+β)=cosβsinα+cosαsinβ\begin{aligned}S_{\triangle ABC}&=S_{\triangle ABD}+S_{\triangle BDC}\\ab\sin(\alpha+\beta)&=ac\sin\alpha+bc\sin\beta\\\sin(\alpha+\beta)&=\frac cb\sin\alpha+\frac ca\sin\beta\\\sin(\alpha+\beta)&=\cos\beta\sin\alpha+\cos\alpha\sin\beta\end{aligned}
sin(αβ)\sin(\alpha-\beta) sin(αβ)=sin(α+(β))=cos(β)sinα+cosαsin(β)=cosβsinαcosαsinβ\begin{aligned}&\sin(\alpha-\beta)\\=&\sin(\alpha+(-\beta))\\=&\cos(-\beta)\sin\alpha+\cos\alpha\sin(-\beta)\\=&\cos\beta\sin\alpha-\cos\alpha\sin\beta\end{aligned}
cos(α+β)\cos(\alpha+\beta) cos(α+β)=sin(90αβ)=sin((90α)+(β))=cos(90α)sin(β)+cos(β)sin(90α)=sinαsinβ+cosβcosα=cosβcosαsinβsinα\begin{aligned}&\cos(\alpha+\beta)\\=&\sin(90^{\circ}-\alpha-\beta)\\=&\sin((90^{\circ}-\alpha)+(-\beta))\\=&\cos(90^{\circ}-\alpha)\sin(-\beta)+\cos(-\beta)\sin(90^{\circ}-\alpha)\\=&-\sin\alpha\sin\beta+\cos\beta\cos\alpha\\=&\cos\beta\cos\alpha-\sin\beta\sin\alpha\end{aligned}
cos(αβ)\cos(\alpha-\beta) cos(αβ)=cos(α+(β))=cos(β)cosαsin(β)sinα=cosβsinα+sinβsinα\begin{aligned}&\cos(\alpha-\beta)\\=&\cos(\alpha+(-\beta))\\=&\cos(-\beta)\cos\alpha-\sin(-\beta)\sin\alpha\\=&\cos\beta\sin\alpha+\sin\beta\sin\alpha\end{aligned}

# 递推式

# Sn=(a+b)n%mS_n=\left\lceil (a+\sqrt b)^n\right\rceil\%m

ThoughtsThoughts SolutionSolution
根据二项式定理,可以设计以下两个式子 (a+b)n=An+Bnb(a+\sqrt b)^n=A_n+B_n\sqrt b
(ab)n=AnBnb(a-\sqrt b)^n=A_n-B_n\sqrt b
通过转换来的式子合并一下 (a+b)n+(ab)n=2An(a+\sqrt b)^n+(a-\sqrt b)^n=2A_n
(a+b)n=2An(ab)n(a+\sqrt b)^n=2A_n-(a-\sqrt b)^n
利用限制条件有 a1<b<a\because a-1\lt \sqrt b\lt a
0<ab<0\therefore 0\lt a-\sqrt b\lt 0
(a+b)n=2An(ab)n{<2An>2An1(a+b)n=2An\therefore (a+\sqrt b)^n=2A_n-(a-\sqrt b)^n\left\{\begin{aligned} &\lt 2A_n \\ &\gt 2A_n-1\end{aligned}\right.\Rightarrow \left\lceil(a+\sqrt b)^n\right\rceil=2A_n
得到新式 (a+b)n=2An=(a+b)n+(ab)n\left\lceil(a+\sqrt b)^n\right\rceil=2A_n=(a+\sqrt b)^n+(a-\sqrt b)^n
代数转换 x=a+b,y=abx=a+\sqrt b,\quad y=a-\sqrt b
(a+b)n+(ab)n=(a+\sqrt b)^n +(a-\sqrt b)^n=\;xn+yn=(x+y)(xn1+yn1)xy(xn2+yn2)x^n+y^n=(x+y)(x^{n-1}+y^{n-1})-xy(x^{n-2}+y^{n-2})
构造递推函数 g(n)=xn+ynx+y=2axy=a2bg(n)=x^n+y^n\quad x+y=2a\quad xy=a^2-b
\therefore\; g(n)=2a×g(n1)(a2b2)×g(n2),g(1)=2a,g(0)=2g(n)=2a\times g(n-1)-(a^2-b^2)\times g(n-2),\quad g(1)=2a,\quad g(0)=2

# 时间化简

# f(k)=i1=LHi2=LH...in=LH[gcd(i1,i2,...,in)=k]f(k)=\sum\limits_{i_1=L}^H\sum\limits_{i_2=L}^H...\sum\limits_{i_n=L}^H[gcd(i_1,i_2,...,i_n)=k]

ThoughtsThoughts SolutionSolution
构建基础方程式 由变换式 F(k)=kdf(d)f(k)=kdμ(dk)F(d)F(k)=\sum\limits_{k\mid d}f(d)\Rightarrow f(k)=\sum\limits_{k\mid d}\mu(\frac dk)F(d)
构建 F(k)=i1=LHi2=LH...in=LH[kgcd(i1,i2,...,in)]F(k)=\sum\limits_{i_1'=L}^H\sum\limits_{i_2'=L}^H...\sum\limits_{i_n'=L}^H[k\mid gcd(i_1,i_2,...,i_n)]
化简 F(x)F(x) 不去枚举不必要枚举的数,令i=iki'=\frac ik,即枚举倍数
F(k)=i1=L1kHki2=L1kHk...in=L1kHk1=(HkL1k)n\therefore F(k)=\sum\limits_{i_1'=\frac {L-1}k}^{\frac Hk}\sum\limits_{i_2'=\frac {L-1}k}^{\frac Hk}...\sum\limits_{i_n'=\frac {L-1}k}^{\frac Hk}1=(\left\lfloor \frac Hk\right\rfloor-\left\lfloor\frac {L-1}k\right\rfloor)^n
L1L-1是前缀和思想,向前取一位
根据反演式进行变换 f(k)=kdμ(dk)F(d)f(k)=\sum\limits_{k\mid d}\mu(\frac dk)F(d)
我们在枚举d时同样要枚举倍数
\therefored=dkd'=\frac dk,同时令 L=L1k,H=HkL'=\frac {L-1}k,\;H'=\frac Hk
则此时 f(k)=d=1Hμ(d)F(dk)f(k)=\sum\limits_{d'=1}^{H'}\mu(d')F(d'k)
化简 f(x)f(x) F(dk)=(HdkL1dk)nF(d'k)=(\left\lfloor\frac{H}{d'k}\right\rfloor-\left\lfloor\frac{L-1}{d'k}\right\rfloor)^n
f(k)=d=1Hμ(d)(HdLd)nf(k)=\sum\limits_{d'=1}^{H'}\mu(d')(\left\lfloor\frac{H'}{d}\right\rfloor-\left\lfloor\frac{L'}{d'}\right\rfloor)^n
Last Updated: 10/14/2023, 7:51:49 PM