## 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 »

- Generate elements of the array following given conditions
- Program to find the Nth Prime Number
- Check if each element of the given array is the product of exactly K prime numbers
- Maximize the size of array by deleting exactly k sub-arrays to make array prime
- Check if the given string is vowel prime
- Sum of all odd factors of numbers in the range [l, r]
- Largest number not greater than N which can become prime after rearranging its digits
- Count the number of primes in the prefix sum array of the given array
- Sum of all even factors of numbers in the range [l, r]
- Sum of Semi-Prime Numbers less than or equal to N
- Find prime number K in an array such that (A[i] % K) is maximum
- Sum of multiplication of triplet of divisors of a number
- Count of distinct sums that can be obtained by adding prime numbers from given arrays
- Check for an array element that is co-prime with all others
- Check whether N is a Dihedral Prime Number or not
- Product of Primes of all Subsets
- Queries for the difference between the count of composite and prime numbers in a given range
- Find the sum of all Truncatable primes below N
- Rearrange the given string such that all prime multiple indexes have same character
- Sum of prime numbers without odd prime digits
- Square free semiprimes in a given range using C++ STL

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 »

Given two numbers N and K. We need to find out if ‘N’ can be written as sum of ‘K’ prime numbers. Given N <=… Read More »

Given three integers a, b, n .Your task is to print number of numbers between a and b including them also which have n-divisors. A… Read More »

Generate all prime numbers between two given numbers. The task is to print prime numbers in that range. The Sieve of Eratosthenes is one of… Read More »

A Left-truncatable prime is a prime which in a given base (say 10) does not contain 0 and which remains prime when the leading (“left”)… Read More »

Question 1 : Write a program to determine whether a given number can be expressed as sum of two prime numbers or not. For example… Read More »

Given a number n, find the n-th square-free number. A number is square-free if it is not divisible by a perfect square other than 1.… Read More »

Given a positive integer n, count distinct number of pairs (x, y) that satisfy following conditions : (x + y) is a prime number. (x… Read More »

Given a number n, count all distinct divisors of it. Examples: Input : 18 Output : 6 Divisors of 18 are 1, 2, 3, 6,… Read More »

Given a number n, count total perfect divisors of n. Perfect divisors are those divisors which are square of some integer. For example a perfect… Read More »

We can calculate the prime factorization of a number “n” in O(sqrt(n)) as discussed here. But O(sqrt n) method times out when we need to… Read More »

Given an array arr[], find nearest element for every element such that there is at least one common prime factor. In output, we need to… Read More »

Given an integer N. The task is to find a number that is smaller than or equal to N and has maximum prime factors. In… Read More »

There are Q queries. Each query is of the form of L and R. The task is to output sum of number of prime factors… Read More »

Given an array of N integers where N is even. There are two kinds of operations allowed on the array. Increase the value of any… Read More »