|
|
A209301
|
|
Table T(n,k) n, k > 0, T(n,k)=n-k+1, if n>=k, T(n,k)=k-n+2, if n < k. Table read by sides of squares from T(1,n) to T(n,n), then from T(n,n) to T(n,1).
|
|
3
|
|
|
1, 3, 1, 2, 4, 3, 1, 2, 3, 5, 4, 3, 1, 2, 3, 4, 6, 5, 4, 3, 1, 2, 3, 4, 5, 7, 6, 5, 4, 3, 1, 2, 3, 4, 5, 6, 8, 7, 6, 5, 4, 3, 1, 2, 3, 4, 5, 6, 7, 9, 8, 7, 6, 5, 4, 3, 1, 2, 3, 4, 5, 6, 7, 8, 10, 9, 8, 7, 6, 5, 4, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 10, 9, 8, 7
(list;
table;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
In general, let m be natural number. The first column of the table T(n,1) is the sequence of the natural numbers A000027. In all columns with number k (k > 1) the segment with the length of (k-1): {m+k-2, m+k-3, ..., m} shifts the sequence A000027. For m=1 the result is A004739, for m=2 the result is A004738. This sequence is result for m=3.
|
|
LINKS
|
|
|
FORMULA
|
For the general case
a(n ) = m*v+(2*v-1)*(t*t-n)+t,
where
t = floor((sqrt(n)-1/2)+1,
v = floor((n-1)/t)-t+1.
For m=3
a(n ) = 3*v+(2*v-1)*(t*t-n)+t,
where
t = floor((sqrt(n)-1/2)+1,
v = floor((n-1)/t)-t+1.
|
|
EXAMPLE
|
The start of the sequence as table for the general case:
1....m..m+1..m+2..m+3..m+4..m+5...
2....1....m..m+1..m+2..m+3..m+4...
3....2....1....m..m+1..m+2..m+3...
4....3....2....1....m..m+1..m+2...
5....4....3....2....1....m..m+1...
6....5....4....3....2....1....m...
7....6....5....4....3....2....1...
...
The start of the sequence as triangle array read by rows for the general case:
1;
m,1,2;
m+1,m,1,2,3;
m+2,m+1,m,1,2,3,4;
m+3,m+2,m+1,m,1,2,3,4,5;
m+4, m+3,m+2,m+1,m,1,2,3,4,5,6;
m+5, m+4, m+3,m+2,m+1,m,1,2,3,4,5,6,7;
...
Row number r contains 2*r -1 numbers: m+r-2, m+r-1,...m,1,2,...r.
The start of the sequence as triangle array read by rows for m=3:
1;
3,1,2;
4,3,1,2,3;
5,4,3,1,2,3,4;
6,5,4,3,1,2,3,4,5;
7,6,5,4,3,1,2,3,4,5,6;
8,7,6,5,4,3,1,2,3,4,5,6,7;
...
|
|
PROG
|
(Python)
t=int((math.sqrt(n))-0.5)+1
v=int((n-1)/t)-t+1
result=k*v+(2*v-1)*(t**2-n)+t
|
|
CROSSREFS
|
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|