SimpleMathProblemDiv1
TCO19 SRM 741 · 2018-10-30 · by Blue.Mary
TCO19 SRM 741 · 2018-10-30 · by Blue.Mary · Advanced Math
Problem Statement
Problem Statement
The function g(n, p) is defined for all positive integers n and all primes p. Its definition is as follows:
if n is not divisible by p:
g(n,p) = 0
otherwise:
g(n,p) = the largest power of p that does not exceed n
The function f(n) is defined for all positive integers as follows: f(n) is the sum of g(n,p) over all primes p.
You are given an
Notes
- You may assume that the largest possible output fits into a long.
Constraints
- X will be between 1 and 3,333,377,777, inclusive.
Examples
0)
1 Returns: 0
1)
8 Returns: 36
2)
15 Returns: 128
3)
777444111 Returns: 342683738130575177
4)
2 Returns: 2
Submissions are judged against all 79 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Coding Area
Language: C++17 · define a public class SimpleMathProblemDiv1 with a public method long long calculate(long long X) · 79 test cases · 2 s / 256 MB per case