## Sieve of Atkin

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 »

- Generate elements of the array following given conditions
- Program to find the Nth Prime Number
- Check if each element of the given array is the product of exactly K prime numbers
- Maximize the size of array by deleting exactly k sub-arrays to make array prime
- Check if the given string is vowel prime
- Sum of all odd factors of numbers in the range [l, r]
- Largest number not greater than N which can become prime after rearranging its digits
- Count the number of primes in the prefix sum array of the given array
- Sum of all even factors of numbers in the range [l, r]
- Sum of Semi-Prime Numbers less than or equal to N
- Find prime number K in an array such that (A[i] % K) is maximum
- Sum of multiplication of triplet of divisors of a number
- Count of distinct sums that can be obtained by adding prime numbers from given arrays
- Check for an array element that is co-prime with all others
- Check whether N is a Dihedral Prime Number or not
- Product of Primes of all Subsets
- Queries for the difference between the count of composite and prime numbers in a given range
- Find the sum of all Truncatable primes below N
- Rearrange the given string such that all prime multiple indexes have same character
- Sum of prime numbers without odd prime digits
- Square free semiprimes in a given range using C++ STL

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 »

Given a large number n and a prime p, how to efficiently compute n! % p? Examples : Input: n = 5, p = 13… Read More »

In this post “Important top 10 algorithms and data structures for competitive coding “. Topics : Graph algorithms Dynamic programming Searching and Sorting: Number theory… 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 »

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 »

Euler’s Totient function Φ(n) for an input n is count of numbers in {1, 2, 3, …, n} that are relatively prime to n, i.e.,… 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 count of numbers in {1, 2, 3, …, n} that are relatively prime to n, i.e.,… 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, print all primes smaller than or equal to n. It is also given that n is a small number. Example: Input… Read More »