A sequence of numbers is constructed from a number x with the following steps:
- List the n digits of x.
- Compute the (
)st term as the sum of the digits of x.
- Compute the remaining terms as the sum of the previous n terms.
A repfigit (or Keith) number is a starting number greater than 9 that reappears in the sequence. For example, starting with 14, one gets 1, 4, 5, 9, 14. Starting with 197, one gets 1, 9, 7, 17, 33, 57, 107, 197. Thus, both 14 and 197 are repfigit numbers.
Write a function to determine whether the input number (given as a character string) is a repfigit number.
Solution Stats
Problem Comments
3 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers5
Suggested Problems
More from this Author321
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Cool problem, Chris! FYI, tests 8 and 9 appear to be identical.
Thanks Christian. Best wishes for 2026!
Thank you, and the same to you!