Given a collection of one or more integer arrays of equal length, I'm looking to predict the most likely next array. Elements typically only increment by one or jump back to zero, though other changes are definitely possible.
Example 1:
[0, 0, 0]
[0, 0, 1]
[0, 0, 2]
I'd expect to get:
[0, 0, 3]
Example 2:
[2, 0, 0]
[4, 1, 0]
[6, 2, 0]
I'd expect to get:
[8, 3, 0]
Example 3:
[0, 0, 0]
[0, 0, 1]
[0, 0, 2]
[0, 1, 0]
[0, 1, 1]
[0, 1, 2]
I'd expect to get:
[0, 2, 0]
Cases 1 and 2 are easy enough to spot, but I'm having a hard time trying to figure out how to detect the pattern in example 3. What sort of keywords do I need to google to make some headway here?
Edit: response to Paul. Although each element in the pattern might look like anything, if the pattern isn't somehow build up from constant additions and cyclical resets to zero then the pattern is already so nonsensical that my algorithm doesn't have to do a good job any more. So I don't care about complicated polynomials or [+1, +1, +2, -5, +7] addition rules.
