Problem C. Happy 2004

时间限制 2 ms   内存限制 32 MB

Consider a positive integer X,and let S be the sum of all positive integer divisors of 2004^X. Your job is to determine S modulo 29 (the rest of the division of S by 29).

Take X = 1 for an example. The positive integer divisors of 2004^1 are 1, 2, 3, 4, 6, 12, 167, 334, 501, 668, 1002 and 2004. Therefore S = 4704 and S modulo 29 is equal to 6.
 

输入数据

The input consists of several test cases. Each test case contains a line with the integer X (1 <= X <= 10000000).

A test case of X = 0 indicates the end of input, and should not be processed.
 

输出数据

For each test case, in a separate line, please output the result of S modulo 29.
 

样例输入

复制
1
10000
0

样例输出

复制
6
10

提交

请先 登录

© 2025 FAQs Contact About