The second pentagonal numbers are a collection of objects which can be arranged in the form of a regular pentagon.
Second Pentagonal series is:
2, 7, 15, 26, 40, 57, 77, 100, 126, …..
Find the Nth term of the Second Pentagonal Series
Given an integer N. The task is to find the N-th term of the second pentagonal series.
Input: N = 1
Input: N = 4
Approach: The idea is to find the general term of the series which can be computed with the help of the following observations as below:
Series = 2, 7, 15, 26, 40, 57, 77, 100, 126, …..
Difference = 7 – 2, 15 – 7, 26 – 15, 40 – 26, …………….
= 5, 8, 11, 14……which is an AP
So nth term of given series
nth term = 2 + (5 + 8 + 11 + 14 …… (n-1)terms)
= 2 + (n-1)/2*(2*5+(n-1-1)*3)
= 2 + (n-1)/2*(10+3n-6)
= 2 + (n-1)*(3n+4)/2
= n*(3*n + 1)/2
Therefore, the Nth term of the series is given as
Below is the implementation of 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.
- Find all numbers up to N which are both Pentagonal and Hexagonal
- n'th Pentagonal Number
- Centered pentagonal number
- Pentagonal Pyramidal Number
- Program to check if N is a Pentagonal Number
- Find the sum of the first N Centered Pentagonal Number
- Program to check if N is a Centered Pentagonal Number or not
- Count of N-digit Numbers having Sum of even and odd positioned digits divisible by given numbers
- Fill the missing numbers in the array of N natural numbers such that arr[i] not equal to i
- Count of numbers upto M divisible by given Prime Numbers
- Check if a given pair of Numbers are Betrothed numbers or not
- Numbers less than N which are product of exactly two distinct prime numbers
- Print N lines of 4 numbers such that every pair among 4 numbers has a GCD K
- Maximum sum of distinct numbers such that LCM of these numbers is N
- Count numbers which can be constructed using two numbers
- Count numbers which are divisible by all the numbers from 2 to 10
- Number of ways to obtain each numbers in range [1, b+c] by adding any two numbers in range [a, b] and [b, c]
- Absolute difference between the Product of Non-Prime numbers and Prime numbers of an Array
- Absolute Difference between the Sum of Non-Prime numbers and Prime numbers of an Array
- Print numbers such that no two consecutive numbers are co-prime and every three consecutive numbers are co-prime
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.