Given a number of the form 11..1 such that number of digits in it is smaller than 10, find square of the number.
Input : 111111 Output : 12345654321 Input : 1111 Output : 1234321
Squares of 11…1 (where length is smaller than 10) are called Demlo numbers. A demlo number is number which consist of 1, 2, 3….n, n-1, n-2, …..1.
Demlo numbers are:
1 = 1 11 * 11 = 121 111 * 111 = 12321 1111 * 1111 = 1234321
To find demlo number, first we find append n numbers which are increasing and then append numbers which are decreasing.
This article is contributed by nuclode. 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 write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Check if a number is perfect square without finding square root
- 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
- Nth non-Square number
- N-th number which is both a square and a cube
- Centered Square Number
- Square root of a number using log
- Square Free Number
- Nth Square free number
- Square pyramidal number (Sum of Squares)
- Check if given number is perfect square
- Largest number that is not a perfect square
- Square root of a number without using sqrt() function
- Largest factor of a given number which is a perfect square
- Minimum number of Square Free Divisors
Improved By : Mithun Kumar