Problem 60788. Construct the number counts sequence
A sequence is constructed in the following way. The zeroth term is 1, and the next terms are determined by counting the number in the sequence so far. Therefore, after the first count, the sequence is 1, 1, 1, or the initial 1 followed by “one 1” or 1, 1. After the second count, the sequence is 1, 1, 1, 3, 1, and because the third count is “one 3, four 1s”, the sequence becomes 1, 1, 1, 3, 1, 1, 3, 4, 1. In listing the counts, start with the largest numbers.
Write a function to report the nth term of the sequence as well as the number of counts needed to generate that term. Remember that the sequence starts with the zeroth term, 1.
Solution Stats
Solution Comments
Show commentsProblem Recent Solvers4
Suggested Problems
-
Construct the number counts sequence
4 Solvers
More from this Author291
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!