Problem 59871. List the segmented numbers
The sequence of segmented numbers begins 1, 2, 4, 5, 8, 10, 14, 15, 16. Notice that none of the terms is the sum of consecutive previous terms. The number 3 is not in the sequence between it is 1+2; 11 is not in the sequence because it is 2+4+5, and 12 is not in the sequence because it is 1+2+4+5.
Write a function that returns the nth segmented number.
--------------------
I now realize that this problem is similar to Cody Problem 42832 by HH. That one involves restrictions on the number of terms in the sum, whereas this one asks for larger values of n.
Solution Stats
Problem Comments
-
2 Comments
Christian Schröder
on 13 Apr 2024
Based on your problem description, I would have expected the sixth segmented number to be 10, since given the terms [1, 2, 4, 5, 8], no sum of consecutive terms is equal to 10. What am I missing?
ChrisR
on 13 Apr 2024
My mistake. Thanks for pointing it out.
Solution Comments
Show commentsProblem Recent Solvers5
Suggested Problems
-
Project Euler: Problem 7, Nth prime
1469 Solvers
-
884 Solvers
-
Find third Side of a right triangle given hypotenuse and a side. No * - or other functions allowed
205 Solvers
-
Generate a vector like 1,2,2,3,3,3,4,4,4,4
11498 Solvers
-
Mechanical Advantage of a Gear Train
220 Solvers
More from this Author281
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!