Given a number x, Find y (y > 0) such that x*y + 1 is not a prime.
Input : 2 Output : 4 Input : 5 Output : 3
x*(x-2) + 1 = (x-1)^2 which is not a prime.
For x > 2, y will be x-2 otherwise y will be x+2
- Find coordinates of a prime number in a Prime Spiral
- Program to find the Nth Prime Number
- Find sum of a number and its maximum prime factor
- Find prime number K in an array such that (A[i] % K) is maximum
- Find largest prime factor of a number
- Analysis of Different Methods to find Prime Number in Python
- Find Largest Special Prime which is less than or equal to a given number
- Find the number of primitive roots modulo prime
- Find a sequence of N prime numbers whose sum is a composite number
- Quick ways to check for Prime and find next Prime in Java
- Print the nearest prime number formed by adding prime numbers to N
- Check if a prime number can be expressed as sum of two Prime Numbers
- Number which has the maximum number of distinct prime factors in the range M to N
- Represent a number as a sum of maximum possible number of Prime Numbers
- Check if a number is divisible by all prime divisors of another number
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.