Problem 53990. Classify product/digit-sum sequences
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
Rafael S.T. Vieira
on 26 Nov 2022
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.
Rafael S.T. Vieira
on 26 Nov 2022
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...
Solution Comments
Show commentsProblem Recent Solvers11
Suggested Problems
-
4466 Solvers
-
Given two arrays, find the maximum overlap
1499 Solvers
-
266 Solvers
-
calculate PI without using pi function
95 Solvers
-
651 Solvers
More from this Author279
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!