# Tag Archives: euler-totient

## Count of elements having Euler’s Totient value one less than itself

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… Read More »

## Sum of GCD of all numbers upto N with N itself

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:… Read More »

## Count of pairs upto N such whose LCM is not equal to their product for Q queries

Given a number N, the task is to find the number of pairs (a, b) in the range [1, N] such that their LCM is… Read More »

## Count of numbers upto M with GCD equals to K when paired with M

Given two integers M and K, the task is to count the number of integers between [0, M] such that GCD of that integer with… Read More »

## Highly Totient Number

A highly totient number k is an integer that has more solutions to the equation φ(x) = k, where φ is Euler’s totient function The… Read More »

## Find (1^n + 2^n + 3^n + 4^n) mod 5 | Set 2

Given a very large number N. The task is to find (1n + 2n + 3n + 4n) mod 5. Examples: Input: N = 4… Read More »

## Count integers in a range which are divisible by their euler totient value

Given 2 integers L and R, the task is to find out the number of integers in the range [L, R] such that they are… Read More »

## Find the number of primitive roots modulo prime

Given a prime . The task is to count all the primitive roots of . A primitive root is an integer x (1 <= x… Read More »

## Queries to count the number of unordered co-prime pairs from 1 to N

Given a number N. The task is to find the number of unordered coprime pairs of integers from 1 to N. There can be multiple… Read More »

## Compute power of power k times % m

Given x, k and m. Compute (xxxx…k)%m, x is in power k times. Given x is always prime and m is greater than x. Examples:… Read More »

## Minimum insertions to make a Co-prime array

Given an array of N elements, find the minimum number of insertions to convert the given array into a co-prime array. Print the resultant array… Read More »

## Optimized Euler Totient Function for Multiple Evaluations

Euler Totient Function (ETF) Φ(n) for an input n is count of numbers in {1, 2, 3, …, n} that are relatively prime to n,… Read More »

## Number Theory | Generators of finite cyclic group under addition

Given a number n, find all generators of cyclic additive group under modulo n. Generator of a set {0, 1, … n-1} is an element… Read More »

## Primitive root of a prime number n modulo n

Given a prime number n, the task is to find its primitive root under modulo n. Primitive root of a prime number n is an… Read More »

## Euler’s Totient function for all numbers smaller than or equal to n

Euler’s Totient function Φ(n) for an input n is count of numbers in {1, 2, 3, …, n} that are relatively prime to n, i.e.,… Read More »