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.
- Count the number of operations required to reduce the given number
- Find row number of a binary matrix having maximum number of 1s
- Super Ugly Number (Number whose prime factors are in given set)
- Finding number of digits in n'th Fibonacci number
- Check if a number is an Achilles number or not
- Check if a number is Flavius Number
- Check if the given number is Ore number or not
- Number of digits in the nth number made of given four digits
- Lobb Number
- Strobogrammatic number
- Composite Number
- Heptagonal number
- Motzkin number
- Pentatope number
- N-th polite 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.
Improved By : vt_m