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pi}{2n+1}+b^2\right)\cdots\left(a^2+2ab\cos\frac{2n\pi}{2n+1}+b^2\right)\\{}\\ a^{2n}-b^{2n}=(a-b)(a+b)(a^{n-1}+a^{n-2}b+a^{n-3}b^2+\cdots)(a^{n-1}-a{n-2}+a^{n-3}b^2-\cdots)\\ =(a-b)(a+b)\left(a^2-2ab\cos\frac{\pi}{n}+b^2\right)\left(a^2-2ab\cos\frac{2\pi}{n}+b^2\right)\cdots\left(a^2-2ab\cos\frac{(n-1)\pi}{n}+b^2\right)\\{}\\ a^{2n}+b^{2n}=\left(a^2+2ab\cos\frac{\pi}{2n}+b^2\right)\left(a^2+2ab\cos\frac{3\pi}{2n}+b^2\right)\cdots\left(a^2+2ab\cos\frac{(2n-1)\pi}{2n}+b^2\right)