Challenge overview
Hello and welcome to the challenge!
Write a code which checks how many proper fractions you can make using the given number d
as a denominator. By a proper fraction we consider such a fraction n/d
that GCD(n,d) = 1
(where GCD stands for greatest common divisor).
Examples
solve(1) -> 0
solve(2) -> 1
solve(15) -> 8
Input
- the given number
d
Output
- the amount of proper fractions we can make using the given number
d
as a denominator
You can solve this programming contest in C++, C#, Ruby, JavaScript, Python and many other languages. If you want, you can also take part in other Challenges. Below you can find some of them:
Have fun and good luck! :)