I am trying to solve a problem that requires me to extract a formula from a table, and the table has the following pattern,
\begin{array}{c|c|c|c|c|c|c} \text{row 6} & \text{26}& \text{27}& \text{28}& \text{29}& \text{30}& \text{31}\\ \text{row 5} & \text{25}& \text{24}& \text{23}& \text{22}& \text{21}& \text{32} \\ \text{row 4} & \text{10}& \text{11}& \text{12}& \text{13}& \text{20}& \text{33}\\ \text{row 3} & \text{9}& \text{8}& \text{7}& \text{14}& \text{19}& \text{34}\\ \text{row 2} & \text{2}& \text{3}& \text{6}& \text{15}& \text{18}& \text{35}\\ \text{row 1} & \text{1}& \text{4}& \text{5}& \text{16}& \text{17}& \text{36}\\\hline \text{} & \text{Col. 1}& \text{Col. 2}& \text{Col. 3}& \text{Col. 4}& \text{Col. 5}& \text{Col. 6}\\ \end{array}
In this problem, given a number I'll have to locate it's the row and column position in the table. For example, given a number 4 the answer will be the row and column pair (2, 1)
Though its simple enough for small numbers, but I need to solve it for really large number, such as 1,000,000,000,000,000. And If I try to build a large pre-calculated matrix, it will be too heavy to handle. So I was told to find a formula from the table.
The problem is, I can see the pattern, but I don't know how to approach the pattern to extract a formula from it. Can anyone help?
To solve the pattern it's a good idea looking at "nice points" and looking for regularities. In your case that "nice points" are on diagonal.
Call $a_n$ the succession of points on diagonal, you have: $$ a_n = \{1, 3, 7, 13, 21, 31, \dots \} $$ Can you see something interesting? (Differences of values...)
If you can get a function of values on diagonal, the other ones will be calculated trivially as sums and differences of relative positions to the diagonal point on the column / row.