|
COMMENTS
|
Digits are counted from the right, so d_1(n) is the ones digit, d_2(n) is the tens digit, etc.
d_i(n) can be found using either of the following formulas:
* d_i(n) = floor(n) / 10^(i-1)) mod 10;
* d_i(n) = floor(n / 10^(i-1)) - 10 * floor(n / 10^i).
For n < 1000, this sequence may be written as a series of 10 X 10 sub-tables:
Sub-table 1:
0, 2, 4, 6, 8, 10, 12, 14, 16, 18
3, 5, 7, 9, 11, 13, 15, 17, 19, 21
6, 8, 10, 12, 14, 16, 18, 20, 22, 24
9, 11, 13, 15, 17, 19, 21, 23, 25, 27
12, 14, 16, 18, 20, 22, 24, 26, 28, 30
15, 17, 19, 21, 23, 25, 27, 29, 31, 33
18, 20, 22, 24, 26, 28, 30, 32, 34, 36
21, 23, 25, 27, 29, 31, 33, 35, 37, 39
24, 26, 28, 30, 32, 34, 36, 38, 40, 42
27, 29, 31, 33, 35, 37, 39, 41, 43, 45
Sub-table 2:
5, 7, 9, 11, 13, 15, 17, 19, 21, 23
8, 10, 12, 14, 16, 18, 20, 22, 24, 26
11, 13, 15, 17, 19, 21, 23, 25, 27, 29
14, 16, 18, 20, 22, 24, 26, 28, 30, 32
17, 19, 21, 23, 25, 27, 29, 31, 33, 35
20, 22, 24, 26, 28, 30, 32, 34, 36, 38
23, 25, 27, 29, 31, 33, 35, 37, 39, 41
26, 28, 30, 32, 34, 36, 38, 40, 42, 44
29, 31, 33, 35, 37, 39, 41, 43, 45, 47
32, 34, 36, 38, 40, 42, 44, 46, 48, 50
Sub-table 3:
10, 12, 14, 16, 18, 20, 22, 24, 26, 28
13, 15, 17, 19, 21, 23, 25, 27, 29, 31
16, 18, 20, 22, 24, 26, 28, 30, 32, 34
19, 21, 23, 25, 27, 29, 31, 33, 35, 37
22, 24, 26, 28, 30, 32, 34, 36, 38, 40
25, 27, 29, 31, 33, 35, 37, 39, 41, 43
28, 30, 32, 34, 36, 38, 40, 42, 44, 46
31, 33, 35, 37, 39, 41, 43, 45, 47, 49
34, 36, 38, 40, 42, 44, 46, 48, 50, 52
37, 39, 41, 43, 45, 47, 49, 51, 53, 55
...
Each sub-table is 10 X 10. Let T_n(j,k) = the element in the j-th row of the k-th column of sub-table n. T_n(1,1) = 5*(n-1). T_n(j,1) = 5*(n-1)+3*(j-1). T_n(1,k) = 5*(n-1)+2*(k-1). Altogether, T_n(j,k) = 5*(n-1)+3*(j-1)+2*(k-1) = 5*n+3*j+2*k-10.
(End)
|