Given Q queries which consist of two integers, one is number(1 <= number <= 106) and the other is N., the task is to find… Read More
Tag Archives: Prime Number
Given two numbers A and B where 1 <= A <= B. The task is to count the number of pairs whose elements are co-prime… Read More
A Cunningham chain is a sequence of prime numbers. It is of 2 types: Cunningham chain of the first kind: It is a sequence of… Read More
Find the minimum number of single-digit prime numbers required whose sum will be equal to N. Examples: Input: 11 Output: 3 Explanation: 5 + 3 +… Read More
Given two integers L and R. The task is to find the sum of all prime factors of every number in the range[L-R]. Examples: Input:… Read More
Given a number N. The task is to find the sum of all the prime divisors of N. Examples: Input: 60 Output: 10 2, 3,… Read More
Given a number N. The task is to print the nearest prime if the number is not prime by making it prime by adding prime… Read More
Given an array arr[] of n elements and a number K. The task is to determine if it is possible to reach the end of… Read More
Given a number N, the task is to print all prime numbers less than or equal to N.Examples: Input: 7 Output: 2, 3, 5, 7… 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
Given Q queries and P where P is a prime number, each query has two numbers N and R and the task is to calculate… Read More
Given two numbers M and N. The task is to print the number which has the maximum number of distinct prime factors of numbers in… Read More
Given a number ‘n’, generate the first ‘n’ terms of the Smarandache-Wellin Sequence. The Smarandache-Wellin Sequence is a sequence formed by the Smarandache-Wellin numbers. Each Smarandache-Wellin… Read More
The Fibonacci numbers are the numbers in the following integer sequence. 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ……..… Read More
Given two integers ‘L’ and ‘R’, write a program to find the total numbers that are having prime number of set bits in their binary… Read More