scrutinizing positions of '1's :
$(1,4)$, $4+(2,3)$, $8+(2,3)$, $12+(1,4)$, ...
$$\begin{array} {|r r r|r r r|r} \hline A&1 &2+(2)&B&16+(2)&18+(1)&.. \\ &4+(2) &6+(1)&&20+(1)&22+(2)&.. \\ B&8+(2) &10+(1)&A&24+(1)&26+(2)&.. \\ &12+(1) &14+(2)&&28+(2)&30+(1)&.. \\ \hline
\end{array}$$
- When factoring $n$ in guise of $8+8*(\sum_{k=0}{2^k})+\delta$ where $\delta<8+8*(\sum_k{2^k})$
-Getting the variant $k$ to maximum means we are actually at the level of a subcolumn of this table starting by $(8+8*(\sum_k{2^k})+(2),(8+8*(\sum_k{2^k})+2)+(1))$, where $k$ is maximazed and $\delta$ is the offset to look up for.
-To find the offset $\delta$ we should formulate the expression recurrently until $\delta$ is smaller than 16. the expression can be written $U_n=8+8*(\sum_{k}{2^{k}})+U_{n-1}$ and $U_0=\delta<16$, with $k$ maximized.
-Noted that for $U_0$ and $n$ is even the order of the table is (A,B), the column to the right, otherwise, the order is (B,A).
-Developping the recurrent series contuniously, leads to a number between x+(2), (x+2)+(1) or the way round ,x+(1), (x+2)+(2), which means the digit is $0$, in the other hand, where the number matches one of bounds of this interval, it is $1$.
- Developping the sequence ...
$U_n=\begin{cases} 8+8(\sum_{k_0} 2^{k_0})&+ \\ 8+8(\sum_{k_1}2^{k_1})&+ \\ ...\\ \delta \end{cases}=\begin{cases} 8+8(2^{k_0+1}-1)&+ \\ 8+8(2^{k_1+1}-1)&+ \\ ...\\ \delta \end{cases}=8*\begin{cases} {1..0..1...0..}_{binary} \\ \frac{\delta}{8} \end{cases}$
-Dividing $n$ by $8$ gives a real number, the absolute floored integer is formatted in binary then taken the position of the subcolumn regarding the pairwise of '1's in the binary number, thus the order of (A,B). $\delta$ gives the offset.
-examples ...
n=9
floor(n/8)=1, expressed in binary "1", number of '1's is odd means the order is (B,A)
n-8*(floor(n/8))=1, hence the offset is the first element which is not included in the the first row [2 3], means the digit is 0
n=16
floor(n/8)=2, n-floor(n/8)=0, the offset cant be nil so we subtract $1$ from the binary value.
floor(n/8)-1=1,expressed in binary "1", number of '1's is odd means the order is (B,A).
n-8*(floor(n/8)-1)=8 is the last element which is included in the the second row [5 8], means the digit is 1
n=25
floor(n/8)=3, expressed in binary "11", number of '1's is even means the order is (A,B)
n-8*(floor(n/8))=1, hence the offset is the first element which is included in the the first row [1 4], means the digit is 1
+means addition or array concatenation? – Nicky C Dec 18 '15 at 10:16