Gold
Practice
5 (1 votes)
Hard
Problem
20% Success 10 Attempts 50 Points 2s Time Limit 256MB Memory 1024 KB Max Code

Input consists only of single integer, N.
You must print the answer obtained by given function,


int LittleFun(int N) :
  res = 1
  for i = 1, i ≤ N, ++i
    if gcd(i, N) = 1:
      res = (res * i) % N
  return res

That would be it.


Contraints:
1 ≤ N ≤ 1018

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

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:50
2 votes
Tags:
Number TheoryAlgorithmsMathModulus Arithmetic
Points:50
5 votes
Tags:
MathematicsHardModular arithmeticNumber Theory
Points:50
2 votes
Tags:
MathematicsHardModular arithmeticNumber Theory
Editorial

No editorial available for this problem.