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 »
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 »
Given a number N, print all its unique prime factors and their powers in N. Examples: Input: N = 100 Output: Factor Power 2 2… Read More »
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 »
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 »
A k-Almost Prime Number is a number having exactly k prime factors (not necessary distinct). For example, 2, 3, 5, 7, 11 ….(in fact all… Read More »
Given an array of primes such that the range of primes is small. Remove duplicates from the array. Examples: Input: arr[] = {3, 5, 7,… Read More »
Many programming contest problems are somehow related Prime Numbers. Either we are required to check Prime Numbers, or we are asked to perform certain functions… Read More »
I got interviewed by MAQ via Skype and they asked me below three question and the duration was 20 min :- 1. Write a program… Read More »
Given a limit, print all primes smaller than or equal to the given limit. Examples : Input: limit = 10 Output: 2, 3, 5, 7… Read More »
Given a number n, print all primes smaller than or equal to n. Examples: Input: n = 10 Output: 2, 3, 5, 7 Input: n… Read More »
Wilson’s theorem states that a natural number p > 1 is a prime number if and only if (p – 1) ! ≡ -1 mod… Read More »
Given a number n, check if it is prime or not. We have introduced and discussed School and Fermat methods for primality testing. Primality Test… Read More »
We are given two numbers x and y. We know that a number p divides their product. Can we say for sure that p also… Read More »
Given a number n, print all primes smaller than n. For example, if the given number is 10, output 2, 3, 5, 7. Recommended: Please… Read More »
Round 1 (Coding round): 1) Range [L, R] is given. Need to find what is the maximum repeating digit in prime numbers between L and… Read More »