Problem 43649. 4 Digit Sequence Repetitions
Given a 4 digit integer, a sequence can be created such that the next digit in the sequence is the ones digit from the sum of the four immediately preceding digits.
For example, the first four terms of our infinite sequence of decimal digits are 2, 0, 0, 9. Thus our sequence begins:
2, 0, 0, 9, 1, 0, 0, 0, 1, 1, 2, 4, 8, 5, 9, 6, 8, 8, 1, 3, 0, 2, 6, 1, 9, 8, 4, 2, 3, 7, ...
Given a seed sequence and another 4 digit test pattern, determine the index for the test pattern following the seed sequence, if it exists. Return the index of the first occurrence of the test pattern. If the pattern does not appear, return 0.
For example, in the above sequence, [2 0 0 9] is the seed sequence and if [1 0 0 0] is the test sequence, it has index 5.
Taken from L-S Hahn's New Year's Puzzle for 2009
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers22
Suggested Problems
-
Get the length of a given vector
10990 Solvers
-
Sum the entries of each column of a matrix which satisfy a logical condition.
162 Solvers
-
Count consecutive 0's in between values of 1
436 Solvers
-
419 Solvers
-
272 Solvers
More from this Author11
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!