# Tag Archives: sieve

## Find the prime numbers which can written as sum of most consecutive primes

Given an array of limits. For every limit, find the prime number which can be written as the sum of the most consecutive primes smaller… Read More »

## Emirp numbers

Emirp is the word “prime” spelled backwards, and it refers to a prime number that becomes a new prime number when you reverse its digits.… Read More »

## Smith Number

Given a number n, the task is to find out whether this number is smith or not. A Smith Number is a composite number whose… Read More »

## LCM of First n Natural Numbers

Given a Number n such that 1 <= N <= 10^6, the Task is to Find the LCM of First n Natural Numbers. Examples: Input… Read More »

## Prime factors of LCM of array elements

Given an array arr[] such that 1 <= arr[i] <= 10^12, the task is to find prime factors of LCM of array elements. Examples: Input… Read More »

## Nearest prime less than given number n

You are given a number n ( 3 <= n < 10^6 ) and you have to find nearest prime less than n? Examples: Input… Read More »

## Smallest number divisible by first n numbers

Given a number n find the smallest number evenly divisible by each number 1 to n. Examples: Input : n = 4 Output : 12… Read More »

## Querying maximum number of divisors that a number in a given range has

Given Q queries, of type: L R, for each query you must print the maximum number of divisors that a number x (L <= x… Read More »

## Exactly n distinct prime factor numbers from a to b

You are given two numbers a and b (1 <= a,b <= 10^8 ) and n. The task is to find all numbers between a… Read More »

## N’th Smart Number

Given a number n, find n’th smart number (1<=n<=1000). Smart number is a number which has at least three distinct prime factors. We are given… Read More »

## Least prime factor of numbers till n

Given a number n, print least prime factors of all numbers from 1 to n. The least prime factor of an integer n is the… Read More »

## Print all prime factors and their powers

Given a number N, print all its unique prime factors and their powers in N. Input: N = 100 Output: Factor Power 2 2 5… Read More »

## How to prepare for ACM – ICPC?

ACM ICPC(Association for Computing Machinery – International Collegiate Programming Contest) is a world-wide annual multi-tiered programming contest being organized for over thirteen years. The contest… Read More »

## Count Divisors of Factorial

Given a number n, count total number of divisors of n!. Examples: Input : n = 4 Output: 24 4! is 24. Divisors of 24… Read More »

## Palindromic Primes

A palindromic prime (sometimes called a palprime) is a prime number that is also a palindromic number. Given a number n, print all palindromic primes… Read More »