Tutorials
Go Premium
Data Structure
Java
Python
HTML
Interview Preparation
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
SQL
Web Development
System Design
Aptitude
GfG Premium
Similar Topics
Web Technologies
32.1K+ articles
DSA
19.9K+ articles
Mathematical
5.1K+ articles
Prime Number
615+ articles
number-theory
424+ articles
GCD-LCM
346+ articles
sieve
322+ articles
Modular Arithmetic
207+ articles
prime-factor
191+ articles
HCF
81+ articles
euler-totient
29 posts
Recent Articles
Popular Articles
Sum of GCD of all numbers upto N with N itself
Last Updated: 15 July 2025
Given an integer N, the task is to find the sum of Greatest Common Divisors of all numbers up to N with N itself.Examples:Input: N = 12Output: 40Explanation:GCD of [1, 12]...
read more
Mathematical
DSA
GCD-LCM
number-theory
euler-totient
Count of elements having Euler's Totient value one less than itself
Last Updated: 15 July 2025
Given an array arr[] of N integers, and a range L to R, the task is to find the total number of elements in the array from index L to R that satisfies the following condit...
read more
Dynamic Programming
Mathematical
DSA
Arrays
sieve
prime-factor
Prime Number
euler-totient
Probability of Euler's Totient Function in a range [L, R] to be divisible by M
Last Updated: 15 July 2025
Given three integers L, R, and M, the task is to find the probability of Euler's Totient Function of a number in the range [L, R] is divisible by M.Euler’s Totient functio...
read more
Mathematical
DSA
sieve
prime-factor
Prime Number
euler-totient
Count of integers up to N which are non divisors and non coprime with N
Last Updated: 15 July 2025
Given an integer N, the task is to find the count of all possible integers less than N satisfying the following properties:The number is not coprime with N i.e their GCD i...
read more
DSA
GCD-LCM
sieve
prime-factor
divisors
euler-totient
Count of Distinct strings possible by inserting K characters in the original string
Last Updated: 15 July 2025
Given a string S and an integer K, the task is to find the total number of strings that can be formed by inserting exactly K characters at any position of the string S. Si...
read more
Strings
Mathematical
Combinatorial
DSA
subsequence
Modular Arithmetic
Permutation and Combination
euler-totient
Check if Euler Totient Function is same for a given number and twice of that number
Last Updated: 15 July 2025
Given an integer N, the task is to check whether the Euler’s Totient Function of N and 2 * N are the same or not. If they are found to be the same, then print “Yes”. Other...
read more
Pattern Searching
Mathematical
DSA
number-theory
HCF
euler-totient
Count all possible values of K less than Y such that GCD(X, Y) = GCD(X+K, Y)
Last Updated: 14 April 2021
Given two integers X and Y, the task is to find the number of integers, K, such that gcd(X, Y) is equal to gcd(X+K, Y), where 0 K Y.Examples:Input: X = 3, Y = 15Output: 4...
read more
Mathematical
Technical Scripter
Technical Scripter 2020
DSA
HCF
euler-totient
Generate an array having sum of Euler Totient Function of all elements equal to N
Last Updated: 17 January 2022
Given a positive integer N, the task is to generate an array such that the sum of the Euler Totient Function of each element is equal to N.Examples:Input: N = 6Output: 1 6...
read more
Technical Scripter 2020
DSA
divisors
euler-totient
Count of numbers up to N having at least one prime factor common with N
Last Updated: 20 July 2022
Given an integer N, the task is to count the number of integers from the range [1, N] having at least one in common prime factor with N other than 1.Examples:Input: N = 5O...
read more
Mathematical
DSA
prime-factor
HCF
euler-totient
Natural Numbers
Count number of pairs (i, j) up to N that can be made equal on multiplying with a pair from the range [1, N / 2]
Last Updated: 20 July 2022
Given a positive even integer N, the task is to find the number of pairs (i, j) from the range [1, N] such that the product of i and L1 is the same as the product of j and...
read more
Mathematical
DSA
number-theory
Numbers
euler-totient
Count of non co-prime pairs from the range [1, arr[i]] for every array element
Last Updated: 10 November 2021
Given an array arr[] consisting of N integers, the task for every ith element of the array is to find the number of non co-prime pairs from the range [1, arr[i]].Examples:...
read more
Mathematical
DSA
Arrays
prefix-sum
HCF
euler-totient
Sum of Euler Totient Functions obtained for each divisor of N
Last Updated: 28 May 2021
Given a positive integer N, the task is to find the sum of the Euler Totient Function for all the divisor of the given number N.Examples:Input: N = 3Output: 3Explanation:D...
read more
Mathematical
DSA
euler-totient
Count numbers up to N whose GCD with N is less than that number
Last Updated: 01 February 2023
Given an integer N, the task is to count the values of K ( where 1 ? K? N ), such that 1 GCD(K, N) K.Examples:Input: N = 10Output: 3Explanation: The values of K which sat...
read more
Mathematical
DSA
HCF
euler-totient
Euler Totient for Competitive Programming
Last Updated: 12 March 2024
What is Euler Totient function(ETF)?Euler Totient Function or Phi-function for 'n', gives the count of integers in range '1' to 'n' that are co-prime to 'n'. It is denote...
read more
Mathematical
DSA
euler-totient
Euler Totient Function in Python
Last Updated: 24 April 2024
Euler’s Totient function, also known as Euler's Phi Function Φ (n) is a mathematical function that counts the number of positive integers up to a given integer n that are ...
read more
Mathematical
Picked
DSA
euler-totient
Python-DSA
1
2
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our
Cookie Policy
&
Privacy Policy
Got It !