Given a number N, the task is to print the Nth Hogben number.
Hogben Number: In a spiral arrangement of the integers, Hogben Numbers appear on the main diagonal (see the picture below).
The first few Hogben numbers are 1, 3, 7, 13, 21, 31, 43, 57, 73, 91, 111, 133, 157, 183, 211, 241, 273……. and many more.
Input: N = 4
The 4th Hogben number that lies on the diagonal of the spiral pattern is 13.
Input: N = 7
The 7th Hogben number that lies on the diagonal of the spiral pattern is 43.
We can observe from the sequence of Hogben numbers, that the Nth Hogben number HN is equal to .
Below is the 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.
- Find the Nth digit in the proper fraction of two numbers
- Find the Nth term of the Zumkeller Numbers
- Find the sum of the first Nth Icosagonal Numbers
- Find the sum of the first Nth Centered Tridecagonal Numbers
- Program to print tetrahedral numbers upto Nth term
- Program to print pentatope numbers upto Nth term
- New Algorithm to Generate Prime Numbers from 1 to Nth Number
- Count of numbers whose 0th and Nth bits are set
- Sum of all the numbers in the Nth parenthesis
- Sum of all the numbers in the Nth row of the given triangle
- Find nth Magic Number
- Program to find last two digits of Nth Fibonacci number
- Find nth Fibonacci number using Golden ratio
- Find nth number that contains the digit k or divisible by k.
- Program to find Nth term in the given Series
- Find nth term of the Dragon Curve Sequence
- Program to find the Nth term of the series 3, 7, 13, 21, 31.....
- Find Nth even length palindromic number formed using digits X and Y
- Program to find Nth term of series 1, 3, 12, 60, 360…
- Program to find the Nth term of series -1, 2, 11, 26, 47......
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.