#include using namespace std; typedef long long signed int LL; typedef long long unsigned int LU; #define incID(i, l, r) for(int i = (l) ; i < (r); i++) #define incII(i, l, r) for(int i = (l) ; i <= (r); i++) #define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--) #define decII(i, l, r) for(int i = (r) ; i >= (l); i--) #define inc(i, n) incID(i, 0, n) #define inc1(i, n) incII(i, 1, n) #define dec(i, n) decID(i, 0, n) #define dec1(i, n) decII(i, 1, n) #define inII(v, l, r) ((l) <= (v) && (v) <= (r)) #define inID(v, l, r) ((l) <= (v) && (v) < (r)) #define PB push_back #define EB emplace_back #define MP make_pair #define FI first #define SE second #define PQ priority_queue #define ALL(v) v.begin(), v.end() #define RALL(v) v.rbegin(), v.rend() #define FOR(it, v) for(auto it = v.begin(); it != v.end(); ++it) #define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it) template bool setmin(T & a, T b) { if(b < a) { a = b; return true; } else { return false; } } template bool setmax(T & a, T b) { if(b > a) { a = b; return true; } else { return false; } } template bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } } template bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } } template T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); } template T lcm(T a, T b) { return a / gcd(a, b) * b; } // ---- ---- LL MOD = 1e9 + 7; LL ex(LL x, LL y, LL mod = MOD) { LL z[64], v = 1; inc(i, 64) { z[i] = (i == 0 ? x : z[i - 1] * z[i - 1] % mod); } inc(i, 64) { if((y >> i) & 1) { (v *= z[i]) %= mod; } } return v; } LL dp[100001]; LL t; LL f1(LL n) { return n * n; } LL f2(LL n) { return n * n * n - n + n * n; } LL f3(LL n) { return t; } LL f4(LL n) { return 4 * n * n + 17; } LL f5(LL n) { return ex(n, n * n * n); } LL f6(LL n) { return n; } LL f7(LL n) { return (dp[n] * n) % MOD; } /* LL f1(LL n) { return (n * n) % MOD; } LL f2(LL n) { return ((n * n * n) % MOD + (MOD - n) + n * n) % MOD; } LL f3(LL n) { return t; } LL f4(LL n) { return (4 * n * n + 17) % MOD; } LL f5(LL n) { return ex(n, n * n * n); } LL f6(LL n) { return n; } LL f7(LL n) { return (dp[n] * n) % MOD; } */ /* 4*10^26 xenon: Xe 54 2*10^2222 2^34 ????? Nchoutennnogurafugaaru.hajime,konogurafunihahennganai.konogurafuniN-1kaisousasuru.Ikaimenosousadeha[1,I]nohannideichiyourannsuuwomochiiteseisuuAwoseiseishi,choutennI+1tochoutennAnoaidanihennwotsuikasuru.sousagaowattaatonihakigadekiteiru.kokode,kinosukoawo,2ijouNikanosubetenoseisuuJnitsuitenochoutenn1tochoutennJnokyorinosouwatoteigisuru.ranndamunikouseisarerukinosukoanokitaichiwoXtoshitatoki,N!Xwo10^9+7dewattaamariwomotomenasai.tadashi,konoataihakanarazuseisuuninarukotogashoumeidekiru. N 頂点のグラフがある。はじめ、このグラフには辺がない。このグラフに N-1 回操作する。 I 回目の操作では [1, I] の範囲で一様乱数を用いて整数 A を生成し、頂点 I+1 と頂点 A の間に辺を追加する。 操作が終わった後には木が出来ている。 ここで、木のスコアを、 2 以上 N 以下の全ての整数 J についての頂点 1 と頂点 J の距離の総和と定義する。 ランダムに構成される木のスコアの期待値を X としたとき、N!X を 10^9+7 で割った余りを求めなさい。 ただし、この値は必ず整数になることが証明できる。 */ int main() { // dp[i] = OEIS_A001705[i - 1] // f7(i) = OEIS_A001705[i - 1] * i (= OEIS_A006675[i]) LL f = 1; inc1(i, 100000) { dp[i] = (i == 1 ? 0 : (dp[i - 1] * i + f) % MOD); (f *= i) %= MOD; } cin >> t; inc(q, t) { if(q != 0) { cout << "\n"; } LL n; cin >> n; cout << f1(n) << "\n"; cout << f2(n) << "\n"; cout << f3(n) << "\n"; cout << f4(n) << "\n"; cout << f5(n) << "\n"; cout << f6(n) << "\n"; cout << f7(n) << "\n"; } return 0; }