让你求$2004^x$所有因子之和,因子之和函数是积性函数$sigma(n)=sum_{d|n}d=prod_{i=0}^{m}(sum_{j=0}^{k_i}{P_i^{j}})$可用二项式定理证明,然后2004是给定的固定数,然后该怎么求就怎么求
/** @Date : 2017-09-08 18:56:21 * @FileName: HDU 1452 欧拉定理.cpp * @Platform: Windows * @Author : Lweleth (SoungEarlf@gmail.com) * @Link : https://github.com/ * @Version : $Id$ */ #include <bits/stdc++.h> #define LL long long #define PII pair<int ,int> #define MP(x, y) make_pair((x),(y)) #define fi first #define se second #define PB(x) push_back((x)) #define MMG(x) memset((x), -1,sizeof(x)) #define MMF(x) memset((x),0,sizeof(x)) #define MMI(x) memset((x), INF, sizeof(x)) using namespace std; const int INF = 0x3f3f3f3f; const int N = 1e5+20; const double eps = 1e-8; const LL mod = 29; LL fpow(LL a, LL n) { LL res = 1; while(n) { if(n & 1) res = a * res % mod; a = a * a % mod; n >>= 1; } return res; } int main() { //SUM factor = Sum(1->s)Sum(0->k)P[i]^k) 各个素因子各次和的乘积 LL n; while(cin >> n && n) { LL INV2 = fpow(2, 27); LL INV166 = fpow(166, 27); LL ans = (((fpow(3, n + 1)-1) * INV2 % mod) * ((fpow(167, n + 1)-1) * INV166 % mod) * (fpow(2, 2 * n + 1)-1)) % mod; printf("%lld ", ans); } return 0; }