Given a number n, find the n-th centered cube number.
The Centered cube number counts the number of points which are formed by a point that is surrounded by concentric cubical layers in 3D with i2 points on the square faces of the i-th layer. Source[WIKI]. Please see this image for more clarity.
The first few Centered cube numbers are:
1, 9, 35, 91, 189, 341, 559, 855, 1241, 172…………………………
Input : n = 1 Output : 9 Input : n = 7 Output : 855
Mathematical formula for nth centered cube number is given by:
n-th Centered Cube Number = (2n + 1)(n2 + n + 1)
Below is the basic implementation of the above formula:
3th Centered cube number: 91 10th Centered cube number: 2331
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.
- Percentage increase in volume of the cube if a side of cube is increased by a given percentage
- Centered Dodecagonal Number
- Centered hexagonal number
- Program for centered nonagonal number
- Centered Octadecagonal Number
- Centered triangular number
- Centered tetrahedral number
- Centered heptagonal number
- Program for Centered Icosahedral Number
- Centered Square Number
- Centered pentagonal number
- Centered Octahedral number
- Centered Octagonal Number
- Centered decagonal number
- Centered nonadecagonal number
- Centered Pentadecagonal Number
- Centered dodecahedral number
- Centered Hexadecagonal Number
- Centered tridecagonal number
- Program to check if N is a Centered nonadecagonal 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 : jit_t