Happy 2004
Time Limit:1s | Memory limit:32M |
Accepted Submit:142 | Total Submit:279 |
Consider a positive integer X,and let S be the sum of all positive integer divisors of 2004X. Your job is to determine S modulo 29 (the rest of the division of S by 29). Input 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. Output For each test case, in a separate line, please output the result of S modulo 29.Sample Input 1 10000 0 Output for the Sample Input 6 10 Original: 2004 ACM/ICPC Beijing Practice Problem |
解题:
运用到欧拉定理,费马小定理。要求某个数A的所有因子和,首先将该数分解:
先贴代码