# Tag Archives: Prime Number

## Python program to print all Prime numbers in an Interval

Given two positive integer start and end. The task is to write a Python program toprint all Prime numbers in an Interval. Definition: A prime… Read More »

## Check n^2 – m^2 is prime or not

Given two integers n and m. Check n^2 – m^2 is prime or not. n and m can be very large. Examples: Input : n… Read More »

## Given a number x , find y such that x*y + 1 is not a prime

Given a number x, Find y (y > 0) such that x*y + 1 is not a prime. Examples: Input : 2 Output : 4… Read More »

## Python program to check whether a number is Prime or not

Given a positive integer N. The task is to write a Python program to check if the number is prime or not. Definition: A prime… Read More »

## Sum of all Primes in a given range using Sieve of Eratosthenes

Given a range [L, R]. The task is to find the sum of all the prime numbers in the given range from L to R… Read More »

## Delete all Prime Nodes from a Singly Linked List

Given a singly linked list containing N nodes, the task is to delete all nodes from the list which are prime. Examples: Input : List… Read More »

## Delete all Prime Nodes from a Doubly Linked List

Given a doubly linked list containing N nodes, the task is to delete all nodes from the list which are prime. Examples: Input: List =… Read More »

## Find two distinct prime numbers with given product

Given a number N (greater than 2 ). The task is to find two distinct prime numbers whose product will be equal to the given… Read More »

## Numbers less than N which are product of exactly two distinct prime numbers

Given a number . The task is to find all such numbers less than N and are a product of exactly two distinct prime numbers.… Read More »

## Number of Co-prime pairs from 1 to N with product equals to N

Given a number N. The task is to find the number of co-prime pairs (a, b) from 1 to N such that their product(a*b) is… Read More »

## Length of largest sub-array having primes strictly greater than non-primes

Given an array ‘arr’ of length ‘n’. The task is to find the largest contiguous sub-array having the count of prime numbers strictly greater than… Read More »

## Find four factors of N with maximum product and sum equal to N | Set 3

Given an integer N. The task is to find all factors of N and print the product of four factors of N such that: Sum… Read More »

## Longest Prime Subarray after removing one element

Given an array A of integers. We can remove at most one index from the array. Our goal is to maximize the length of the… Read More »

## Count number of primes in an array

Given an array arr[] of N positive integers. The task is to write a program to count the number of prime elements in the given… Read More »

## Number of prime pairs in an array

Given an array. The task is to count the possible pairs which can be formed using the elements of the array where both of the… Read More »