Cody Problem 53120 involved a sequence in which a term is computed by multiplying the previous two terms and adding the digits of the product. In that problem the first two terms of the sequence were 1 and 2. The next four terms were 2, 4, 8, and 5.
What happens if the first two terms are changed? It turns out that these product/digit-sum sequences can be sorted into five groups. For reasons that will likely be apparent to those who solved Cody Problem 53120, the sequence there (and others like it) is assigned the number 163. The other four types of sequence are assigned the numbers 1, 9, 26, and 62.
Write a function to classify the product/digit-sum sequences given the first two terms a and b. To encourage solvers to find the pattern, loops are banned, and to allow for large inputs, a and b are specified as strings.
Solution Stats
Problem Comments
2 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers13
Suggested Problems
-
Least common multiple of many numbers
255 Solvers
-
Construct a string from letters and counts
146 Solvers
-
Similar Triangles - find the height of the tree
466 Solvers
-
Get the elements of diagonal and antidiagonal for any m-by-n matrix
513 Solvers
-
Return fibonacci sequence do not use loop and condition
854 Solvers
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!
I didn't find a key, but a predominance between the five lists: 9 is the most powerful. 4 or 5 tests are enough, but some have made matrices with more than 25 possible combinations.
Tip FYI: If the sum of the digits of a number is divisible by 3, then the number is also divisible by 3, and the same rule exists for 9. All numbers have similar laws, it seems. A number divisible by 5 ends with 0 or 5, and so on...