Given a number n, the task is to find n-th octahedral number.
A octahedral number belongs to a figurate number and it is the number of spheres in an octahedron built from closely packed spheres. First few octahedral numbers (where n = 0, 1, 2, 3…….) are : 0, 1, 6, 19 and so on.
Input : 4
Output : 44
Input : 8
Output : 344
Formula for nth octahedral number:
n * (2n2+1) / 3
5th Octahedral number: 85
- Write a program to reverse digits of a number
- Write an Efficient Method to Check if a Number is Multiple of 3
- Write an Efficient C Program to Reverse Bits of a Number
- Minimum number of jumps to reach end
- Find minimum number to be divided to make a number a perfect square
- Find whether a given number is a power of 4 or not
- Print all combinations of points that can compose a given number
- Check if a number is multiple of 5 without using / and % operators
- Given a number, find the next smallest palindrome
- Count the number of possible triangles
- Select a random number from stream, with O(1) space
- Program to convert a given number to words
- Efficient program to print all prime factors of a given number
- Check if a number is Palindrome
- Random number generator in arbitrary probability distribution fashion
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.
Improved By : jit_t