Topic Link: Click to open the topic link
The maths problem of Chen Yueliang
Time limit:2000 MS Memory limit:32768 K
Total submit:102 (accepted:46 users) rating:special Judge:no
Description
Chen Yueliang Love Mathematics since childhood, this day the teacher talked about any positive integer n, we can easily find all the factors of N, N1,n2,n3...,nk, called n a total of K factor (including 1 and n itself).
To find the value of K is too simple for Chen Yueliang. So she wanted to ask for the number of factors for all n factors (such as N1 may contain N1 factors (including 1 and N1 itself), N2 may contain N2 factors, ..., NK may contain NK factors, and then calculate the value of s:
Input
The first behavior is an integer t (T <= 10000), which represents the number of groups that test the data.
Then the T row is a positive integer n (n < 2 ^ 31) per line.
Output
For each set of test data, output the value of S.
Sample Input
2
6
9
Sample Output
81
36
Source
National Invitational Program for 2016-class freshmen
Solving:
We know that we can decompose a number of N into n=pa11∗pa22∗pa33∗ ... ∗pann n= p_1^{a_1}* p_2^{a_2}* p_3^{a_3}*...* P_n^{a_n}, where Pi p_i is prime. So the number of factors for n is (a1+1) (a2+1) (a3+1) ... (ak+1) =∏ki=1 (ai+1) (a_1+1) (a_2+1) (a_3+1) ... (a_k+1) =\prod_{i=1}^{k} (a_i+1).
so the number of factors for all n is ∏ki=1 (1+2+3+...+ai+1) =∏ki=1 (1+ai+1) (ai+1) 2 \prod_{i=1}^{k} (1+2+3+...+a_i+1) =\prod_{i=1}^{k}\frac{ (1+a_i+1) (a_i+1)} {2}, but this is only a S=n1+n2+n3+...+nk value