Euler’s Totient Function Problem Statement

Given an integer N, your task is to determine the count of integers between 1 and N (inclusive) that are coprime to N.

Input:

The first line contains an integer 'T' denoting the number of test cases.
For each test case, the input consists of one line containing a single integer 'N'.

Output:

For each test case, output one line with a single integer representing the count of integers between 1 and N, inclusive, that are coprime to N.

Example:

If N is 9, the output should be 6 because there are six integers between 1 and 9 that are coprime to 9: 1, 2, 4, 5, 7, and 8.

Constraints:

  • 1 <= T <= 100
  • 1 <= N <= 10^9
  • Time Limit: 1 second.
Note:
You don't have to print anything. This is already handled. Implement the function to return the result.
Be the first one to answer
Add answer anonymously...
Amadeus Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter