This problem is a programming version of Problem 245 from projecteuler.net
We shall call a fraction that cannot be cancelled down a resilient fraction.
Furthermore we shall define the resilience of a denominator,
, to be the ratio of its proper fractions that are resilient; for example, consider . The proper fractions with a
denominator are . Four of these cannot be
cancelled down, so the resilience is
.
The resilience of a number is then
We further define the coresilience of a number as
Given an integer , find the sum of all integers for which is a unit fraction, that is, a fraction with a numerator of after cancelling down.
Input Format
Each test file contains a single line containing a single integer .
Constraints
Output Format
Print the integer value of the sum of all integers for which is a unit fraction.
Sample Input 0
5
Sample Output 0
10
Explanation 0
Integer | 2 | 3 | 4 | 5 |
---|---|---|---|---|
Euler Phi | 1 | 2 | 2 | 4 |
Coresilience | 1/1 | 1/2 | 2/3 | 1/4 |
The sum of integers with Coresilience a unit fraction:   .