Given a number n, check it is the Stella Octangula number or not. A number of the form where n is a whole number(0, 1, 2, 3, 4, …) is called Stella Octangula. First few Stella Octangula numbers are 0, 1, 14, 51, 124, 245, 426, 679, 1016, 1449, 1990, …
Stella octangula numbers which are perfect squares are 1 and 9653449.
Given a number x, check if it is Stella octangula.
Input: x = 51 Output: Yes For n = 3, the value of expression n(2n2 - 1) is 51 Input: n = 53 Output: No
A simple solution is to run a loop starting from n = 0. For every n, check if n(2n2 – 1) is equal to x. We run the loop while value of n(2n2 – 1) is smaller than or equal to x.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Finding number of digits in n'th Fibonacci number
- Super Ugly Number (Number whose prime factors are in given set)
- Number of digits in the nth number made of given four digits
- Check if the given number is Ore number or not
- Check if a number is an Achilles number or not
- Check if a number is Flavius Number
- Find the sequence number of a triangular number
- Find the smallest missing number
- Program for nth Catalan Number
- Find cubic root of a number
- N'th Smart Number
- K'th Boom Number
- Nearest prime less than given number n
- Disarium Number
- n'th Pentagonal Number
- Keith Number
- Kaprekar Number
- Smith Number
- Harshad (Or Niven) Number
- Deficient 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.