Question: Write a program either in C or Java threads, which calculates the inverse of the totient-Function for the number 999. The totient-Function returns the number
Write a program either in C or Java threads, which calculates the inverse of the totient-Function for the number 999. The totient-Function returns the number of elements that are co-prime to 999. Co-prime to 999 means that the Greatest Common Divisor of 999 and number x, smaller than 999, is equal to 1. Hence, the inverse should return the number of elements that are not co- prime to 999.
Example: totient-Function(8) = 4; inverse of totient-Function(8) = 3. Because only four numbers smaller than 8, have 1 as the Greatest Common Divisor with 8,
namely 1, 3, 5 and 7. The other numbers smaller than 8, namely 2, 4, 6, have 2 and 4 as the Greatest Common Divisor with 8.
Pseudo Code for Greatest Common Divisor: GCD(a, b)
if b == 0 return a
else return GCD(b, (a % b))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
