Nanachi and Euler Totient
Practice
3.5 (13 votes)
Algebra
Easy
Euler's totient function
Math
Number theory
Problem
90% Success 3208 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code
Living alone with Mitty in the Abyss, Nanachi has developed an interest in number theory problems. Nanachi recently came up with the following problem but is unable to solve it.
Let \(\phi(n)\) denote the count of positive integers up to n which are coprime with n. Since summations bore our Nanachi, Nanachi decided to evaluate the function \(f(n)\) instead which is defined as:
\(\displaystyle f(n) = \prod_{d|n} \phi(d)\)
where \(a|b\) mean a divides b. Nanachi seeks your help in finding the value of \(f(n)\).
INPUT
A single integer n
OUTPUT
Value of \(f(n)\). Since this value can be large, output it modulo \(10^9 + 7\).
CONSTRAINTS
\(1 \leq n \leq 10^{12}\)
For 10% of the testcases, \(n \leq 10^6\)
Submissions
Please login to view your submissions
Similar Problems
Points:20
15 votes
Tags:
EasyEuler's totient functionMathNumber Theory
Points:20
38 votes
Tags:
ApprovedEasyEuler's totient functionMathOpen
Editorial