Given a series 7, 15, 32, …… Find the nth term of this series.
Input : 5 Output : 138 Input : 7 Output : 568
Approach : By seeing the pattern of the series we can easily identify that it is a mixed series.
S = 7, 15, 32…..
Each element in the series is multiplied by 2 and then incremented one more than the previous.
S = 7, 15 (2 * 7 + 1), 32 (2 * 15 + 2)…….
By using iteration we can easily find nth term of the series.
Below is the implementation of the above approach :
This article is contributed by Saloni Gupta . 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 write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
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. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.
In case you wish to attend live classes with industry experts, please refer DSA Live Classes