I have a couple of disjoint sequences and want to calculate to which sequence an item belongs to. The formation of the sequences is well known: The sequences $m$ form by incrementing a number $n$ in various intervals $i_k$ based on a stepsize $\sigma$ one after another.
An example: We have sequence $a$ with an interval $i_a=1$ and $b$ with an interval $i_b=i_a=1$. The sequences are formed like this:
$ \begin{array}{c|ccccccccc} \sigma & 0 & 1 & 2 & 3 & 4 & 5 & \ldots \\\hline a & 0 & 2 & 4 & 6 & 8 & 10 & \ldots \\ b & 1 & 3 & 5 & 7 & 9 & 11 & \ldots \\ \end{array} $
For this simple example the sequences are $a=(0,2,4,6,8,10,\ldots)$ and $b=(1,3,5,7,9,11,\ldots)$ and the affiliation is easily calculated, since $a$ has only even and $b$ only odd numbers:
$ m(n) = \begin{cases} a & \text{if }n \bmod 2 = 0\\ b & \text{if }n \bmod 2 = 1\\ \end{cases} $
But how can I formulate an equation, if there are 3 sequences with the same interval? Then there is no trivial odd-even pattern, but alternating ones:
$ \begin{array}{c|ccccccccc} \sigma & 0 & 1 & 2 & 3 & 4 & 5 & \ldots \\\hline a & 0 & 3 & 6 & 9 & 12 & 15 & \ldots \\ b & 1 & 4 & 7 & 10 & 13 & 16 & \ldots \\ c & 2 & 5 & 8 & 11 & 14 & 17 & \ldots \\ \end{array} $
What to do with sequences with different intervals? For example $i_a=1$ and $i_b=2$. Or $i_a=2$ and $i_b=1$?
$ \begin{array}{c|ccccccccc} \sigma & 0 & 1 & 2 & 3 & 4 & 5 & \ldots \\\hline a_{i=1} & 0 & 2 & 3 & 5 & 6 & 8 & \ldots \\ b_{i=2} & 1 & & 4 & & 7 & & \ldots \\ \end{array} \qquad \begin{array}{c|ccccccccc} \sigma & 0 & 1 & 2 & 3 & 4 & 5 & \ldots \\\hline a_{i=2} & 0 & & 3 & & 6 & & \ldots \\ b_{i=1} & 1 & 2 & 4 & 5 & 7 & 8 & \ldots \\ \end{array} $
In these examples the sequence with the higher interval $i_k$ ($b$) is more obvious (to me) and $a$ can be defined by the opposite:
$m_{i_a=1, i_b=2}(n)=\begin{cases} a & \text{if } (n+1)\bmod 3 \not= 0\\ b & \text{if } (n+1)\bmod 3 = 0 \end{cases}$
But what if there are even more sequences $a,b,\ldots,h$ and various random but fixed intervals $1,7,42,1000,\ldots$?
Does anyone know an approach to my problem?
Is there a solution where I can define the formulas programmatically based on the given $m$s and $i$s?
Edit: I have found this question: recognize the sequence numbers? where the website http://oeis.org/ is mentioned. With it I found the (in retrospect easy) answer for the 2nd example:
$m_{i_a=1, i_b=1, i_c=1}(n)=\begin{cases} a & \text{if } (3n)\bmod 3 = 0\\ b & \text{if } (3n+1)\bmod 3 = 0\\ b & \text{if } (3n+2)\bmod 3 = 0 \end{cases}$
But the other sequences don't seem to be so easy…