Contribution from divisors
Practice
4.4 (13 votes)
Prime factorization
Easy
Mathematics
Factorization
Problem
9% Success 4846 Attempts 20 Points 2s Time Limit 256MB Memory 1024 KB Max Code
Let us define a few functions over natural numbers,
\(F(n) =\) sum of odd digits in decimal representation of n.
For example, \(F(123) = 1+3 = 4\) and \(F(15423) = 1+5+3 = 9\).
\(G(n) = \sum\limits_{d|n} f(d)\),
that is, sum of \(F(d)\) over all factors d of n.
For example, \(G(10) = F(1) + F(2) + F(5) + F(10) = 7\).
Input:
First line of the input contains 1 integers, Q, representing number of queries. Next Q line contains 1 integers each, representing n.
Output:
N lines, each line containing 1 integers, representing \(G(n)\).
Constraints:
\( 1 \le Q \le 10^6 \)
\( 1 \le N \le 10^6 \)
Submissions
Please login to view your submissions
Similar Problems
Points:20
44 votes
Tags:
MathematicsEasyNumber TheoryFactorization
Points:20
Tags:
Prime FactorizationEasyMathematicsSieveapprovedFactorization
Points:20
154 votes
Tags:
Number TheoryEasyReadyMathematicsOpenApprovedFactorization
Editorial