Skip to content

Tag Archives: Prime Number

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 Practice… 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
Given a number n, check if it is prime or not. We have introduced and discussed the School method for primality testing in Set 1.Introduction… Read More
Given a positive integer, check if the number is prime or not. A prime is a natural number greater than 1 that has no positive… Read More
Given a range [low..high], print the smallest twin numbers in given range (low and high inclusive). Two numbers are twins if they are primes and… Read More
Online round: [60 mins] 1. given a number N. print in how many ways it can be represented as N = a+b+c+d , 1< =a<… Read More
I was interviewed for Senior Software Engineer position in Walmart (6-8 years of experience,even people with 4yrs exp were also shortlisted) Written Test (Hacker Earth)… Read More
Euler’s Totient function Φ (n) for an input n is the count of numbers in {1, 2, 3, …, n-1} that are relatively prime to… Read More
Given a number n, write an efficient function to print all prime factors of n. For example, if the input number is 12, then the… Read More
Given a number n, write an efficient function to print all prime factors of n. For example, if the input number is 12, then output… Read More
Given a number n, write an efficient function to print all prime factors of n. For example, if the input number is 12, then output… Read More
Given a number, find the next smallest palindrome larger than this number. For example, if the input number is “2 3 5 4 5”, the… Read More

Start Your Coding Journey Now!