HCI '16 - Totient

View as PDF

Submit solution

Points: 12 (partial)
Time limit: 0.2s
Memory limit: 16M

Authors:
Problem type

Functions f(x) and g(y) are defined below.

f(x)={1,if x=ab0,if xab where a and b are integers such that a1 and b>1.

g(y)=i=0yf(ϕ(i))ϕ(i) where ϕ(z) is Euler's totient function.

Given an integer N, output g(N)(mod109+7).

Input

A positive integer N1000000.

Output

The value of g(N)(mod109+7).

Constraints

Average scoring is used for this problem.

The first test case is the sample test below.

Afterwards, there will be 50 test cases worth 2 points each.

In all test cases, 1N1000000.

Sample Input

Copy
5

Sample Output

Copy
6

Explanation

g(5)=00+11+11+02+02+14=6


Comments


  • 0
    r3mark  commented on Dec. 17, 2016, 2:16 a.m.

    What is f(x) if it satisfies both?


    • 3
      fanpu  commented on Dec. 17, 2016, 2:22 a.m.

      f(x) will be 1