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:
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.
- Centered triangular number in PL/SQL
- Program to check if N is a Centered Triangular Number
- First triangular number whose number of divisors exceeds N
- Find the sequence number of a triangular number
- Program to print triangular number series till n
- Triangular Matchstick Number
- Smallest triangular number larger than p
- Squared triangular number (Sum of cubes)
- Check if a number can be represented as a sum of 2 triangular numbers
- Index of smallest triangular number with N digits
- Centered cube number
- Centered Dodecagonal Number
- Centered hexagonal number
- Program for centered nonagonal number
- Centered Octadecagonal Number
- Centered tetrahedral number
- Centered heptagonal number
- Program for Centered Icosahedral Number
- Centered Square Number
- Centered pentagonal 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