{"id":"34c18741-de14-4608-9344-2760e613d3c4","name":"Eulers Totient Function","description":"you have been given a number n, count the number of integers between 1 to n inclusive, which are co-prime to n.\r\n","inputFormat":"The first line contains the integer n. ","outputFormat":"Output an integer in a line.","constraints":"1 <= n <= 10^9","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.util.Scanner;\r\n\r\npublic class Main {\r\n\tpublic static void main(String[] args) {\r\n\t\tScanner scn = new Scanner(System.in);\r\n\t\tint n = scn.nextInt();\r\n\t\tSystem.out.println(euler(n));\r\n\t}\r\n\r\n\tpublic static int euler(int n) {\r\n\t\r\n\t}\r\n}"},"ruby":{"code":""},"python":{"code":""},"javascript":{"code":""}},"points":10,"difficulty":"hard","sampleInput":"7","sampleOutput":"6\r\n","questionVideo":"","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"086949fa-3c5e-40c6-8a9c-f9be4b400318","name":"Number Theory For Experts","slug":"number-theory-for-experts","type":0},{"id":"4940a5f2-3a1e-4899-a580-63aa0c1bc2c9","name":"Eulers Totient Function","slug":"eulers-totient-function","type":1}],"next":{"id":"e7dbeb4b-e828-42af-8a39-8a1d3f4f8c29","name":"Wilsons Theorem","type":1,"slug":"wilsons-theorem"},"prev":{"id":"494d08e9-b9e3-459b-9395-9a9de36aa28c","name":"Linear Diophantine Equation","type":1,"slug":"linear-diophantine-equation"}}}

Eulers Totient Function

you have been given a number n, count the number of integers between 1 to n inclusive, which are co-prime to n.

{"id":"34c18741-de14-4608-9344-2760e613d3c4","name":"Eulers Totient Function","description":"you have been given a number n, count the number of integers between 1 to n inclusive, which are co-prime to n.\r\n","inputFormat":"The first line contains the integer n. ","outputFormat":"Output an integer in a line.","constraints":"1 <= n <= 10^9","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.util.Scanner;\r\n\r\npublic class Main {\r\n\tpublic static void main(String[] args) {\r\n\t\tScanner scn = new Scanner(System.in);\r\n\t\tint n = scn.nextInt();\r\n\t\tSystem.out.println(euler(n));\r\n\t}\r\n\r\n\tpublic static int euler(int n) {\r\n\t\r\n\t}\r\n}"},"ruby":{"code":""},"python":{"code":""},"javascript":{"code":""}},"points":10,"difficulty":"hard","sampleInput":"7","sampleOutput":"6\r\n","questionVideo":"","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"086949fa-3c5e-40c6-8a9c-f9be4b400318","name":"Number Theory For Experts","slug":"number-theory-for-experts","type":0},{"id":"4940a5f2-3a1e-4899-a580-63aa0c1bc2c9","name":"Eulers Totient Function","slug":"eulers-totient-function","type":1}],"next":{"id":"e7dbeb4b-e828-42af-8a39-8a1d3f4f8c29","name":"Wilsons Theorem","type":1,"slug":"wilsons-theorem"},"prev":{"id":"494d08e9-b9e3-459b-9395-9a9de36aa28c","name":"Linear Diophantine Equation","type":1,"slug":"linear-diophantine-equation"}}}
plane

Editor


Loading...

Eulers Totient Function

hard

you have been given a number n, count the number of integers between 1 to n inclusive, which are co-prime to n.

Constraints

1 <= n <= 10^9

Format

Input

The first line contains the integer n.

Output

Output an integer in a line.

Example

Sample Input

7

Sample Output

6

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode