Special matrix
Practice
3.2 (25 votes)
Basic programming
C++
Problem
46% Success 7992 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code
You have an N x M matrix, where 1 to N are rows and 1 to M are columns.
Element at the intersection of \(i^{th}\) row and \(j^{th}\) column is equal to \(F(i+j)\), where \(F(x)\) is equal to the number of prime divisors of x.
Determine the sum of all the elements of the matrix.
Input
- The first line contains an integer T denoting the number of test cases.
- For each test case, the first line contains two space-separated integers N, M.
Output
For each test case, print the sum of all the elements of the matrix in a new line.
Constraints
\(1 ≤ T ≤ 10 \\ 1 ≤ N, M ≤10^6\)
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
58 votes
Tags:
ApprovedEasyImplementationOpen
Points:20
30 votes
Tags:
ImplementationBasic ProgrammingBasics of Greedy Algorithms
Points:20
33 votes
Tags:
Basic ProgrammingMathNumber Theory
Editorial
Login to unlock the editorial