Given an integer N, the task is to check whether N the given number can be made a perfect square after adding 1 to it.
3 + 1 = 4 which is a perfect square i.e. 22
5 + 1 = 6 which is not a perfect square.
Approach: Check whether n + 1 is a perfect square or not by taking the square root of n + 1 and checking whether it is an integer. If it is then n + 1 is a perfect square and n is a sunny number.
Below is the implementation of the above approach:
- Check if a number is perfect square without finding square root
- Check if given number is perfect square
- Check perfect square using addition/subtraction
- Check if product of array containing prime numbers is a perfect square
- Largest number that is not a perfect square
- Find minimum number to be divided to make a number a perfect square
- Number of times the largest perfect square number can be subtracted from N
- Find the Next perfect square greater than a given number
- Largest factor of a given number which is a perfect square
- Count numbers upto N which are both perfect square and perfect cube
- Largest Divisor of a Number not divisible by a perfect square
- Minimum digits to remove to make a number Perfect Square
- Find the character made by adding all the characters of the given string
- Program to check Plus Perfect Number
- PHP | Check if a number is Perfect 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 firstname.lastname@example.org. 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.