Juggler Sequence is a series of integer number in which the first term starts with a positive integer number a and the remaining terms are generated from the immediate previous term using the below recurrence relation :
Juggler Sequence starting with number 3:
5, 11, 36, 6, 2, 1
Juggler Sequence starting with number 9:
9, 27, 140, 11, 36, 6, 2, 1
Given a number n we have to print the Juggler Sequence for this number as the first term of the sequence.
Input: 9 Output: 9, 27, 140, 11, 36, 6, 2, 1 We start with 9 and use above formula to get next terms. Input: 6 Output: 6, 2, 1
3 5 11 36 6 2 1 9 27 140 11 36 6 2 1
- The terms in Juggler Sequence first increases to a peak value and then starts decreasing.
- The last term in Juggler Sequence is always 1.
This article is contributed by Harsh Agarwal. 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 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.
- Look-and-Say Sequence
- Padovan Sequence
- Aliquot Sequence
- Recaman's sequence
- Sum of the sequence 2, 22, 222, .........
- Sylvester's sequence
- Golomb sequence
- Digit - Product - Sequence
- Find n-th term in sequence 1, 1, 2, 1, 2, 3, 1, 2, 3, 4, ....
- k-th number in the Odd-Even sequence
- Newman-Conway Sequence
- Sum of Arithmetic Geometric Sequence
- Connell Sequence
- Stern-Brocot Sequence
- Print n terms of Newman-Conway Sequence
- Finding nth term of any Polynomial Sequence
- Moser-de Bruijn Sequence
- Minimum number of operations to convert a given sequence into a Geometric Progression
- Program to print Collatz Sequence
- Smarandache-Wellin Sequence