Given an integer n, find the nth Centered triangular number.
Centered Triangular Number is a centered polygonal number that represents a triangle with a dot in the centre and all other dots surrounding the centre in successive triangular layers [Source : Wiki ]
Pictorial Representation :
The first few centered triangular number series are :
1, 4, 10, 19, 31, 46, 64, 85, 109, 136, 166, 199, 235, 274, 316, 361, 409, 460………………………..
Input : n = 1 Output : 4 Explanation : A dot in the centre and 3 dots forming the triangle outside it, thus 4. Input : n = 6 Output : 64 Input : n = 10 Output : 166
nth Term of centered triangular number is given by:
Basic Implementation of the above approach:
- Centered triangular number in PL/SQL
- Centered Square Number
- Centered heptagonal number
- Centered tetrahedral number
- Centered Dodecagonal Number
- Centered hexagonal number
- Centered tridecagonal number
- Centered cube number
- Centered nonadecagonal number
- Centered Octagonal Number
- Centered dodecahedral number
- Centered Pentadecagonal Number
- Centered Hexadecagonal Number
- Centered Octadecagonal Number
- Centered Octahedral 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 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