##
Program to find sum of prime numbers between 1 to n
July 29, 2017

Write a C program to find sum of all prime numbers between 1 to n. Examples: Input : 10 Output : 17 Explanation : Primes… Read More »

July 29, 2017

Write a C program to find sum of all prime numbers between 1 to n. Examples: Input : 10 Output : 17 Explanation : Primes… Read More »

July 11, 2017

Given an array of natural numbers count the sum of its proper divisors for every element in array. Input : int arr[] = {8, 13,… Read More »

July 6, 2017

Given a number N, print all numbers in range from 1 to N having exactly 3 divisors. Input : N = 16 Output : 4… Read More »

July 4, 2017

Given an array of integers. Find the total number of subarrays whose product of all elements doesn’t contain repeating prime factor in prime decomposition of… Read More »

June 26, 2017

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 »

June 9, 2017

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 »

May 20, 2017

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 »

May 5, 2017

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 »

April 20, 2017

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 »

April 9, 2017

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 »

March 14, 2017

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 »

March 10, 2017

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 »

March 7, 2017

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 »