cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A211161 Table T(n,k) = n, if k is odd, k/2 if k is even; n, k > 0, read by antidiagonals.

Original entry on oeis.org

1, 1, 2, 1, 1, 3, 2, 2, 1, 4, 1, 2, 3, 1, 5, 3, 2, 2, 4, 1, 6, 1, 3, 3, 2, 5, 1, 7, 4, 2, 3, 4, 2, 6, 1, 8, 1, 4, 3, 3, 5, 2, 7, 1, 9, 5, 2, 4, 4, 3, 6, 2, 8, 1, 10, 1, 5, 3, 4, 5, 3, 7, 2, 9, 1, 11, 6, 2, 5, 4, 4, 6, 3, 8, 2, 10, 1, 12, 1, 6, 3, 5, 5, 4, 7, 3
Offset: 1

Views

Author

Boris Putievskiy, Jan 30 2013

Keywords

Comments

In general, let B and C be sequences. By b(n) and c(n)denote elements B and C respectively. Table T(n,k) = b(n), if k is odd, c(k) if k is even. For this sequence b(n)=n, c(k)=k.
Row T(n,k) is b(n),c(1),b(n),c(2),b(n),c(3),...Numbers c(1),c(2),c(3),... sandwiched between b(n)'s. For this sequence numbers 1,2,3,... (A000027) sandwiched between n's.

Examples

			The start of the sequence as table for general case:
b(1)..c(1)..b(1)..c(2)..b(1)..c(3)..b(1)..c(4)...
b(2)..c(1)..b(2)..c(2)..b(2)..c(3)..b(2)..c(4)...
b(3)..c(1)..b(3)..c(2)..b(3)..c(3)..b(3)..c(4)...
b(4)..c(1)..b(4)..c(2)..b(4)..c(3)..b(4)..c(4)...
b(5)..c(1)..b(5)..c(2)..b(5)..c(3)..b(5)..c(4)...
b(6)..c(1)..b(6)..c(2)..b(6)..c(3)..b(6)..c(4)...
b(7)..c(1)..b(7)..c(2)..b(7)..c(3)..b(7)..c(4)...
b(8)..c(1)..b(8)..c(2)..b(8)..c(3)..b(8)..c(4)...
. . .
The start of the sequence as triangle array read by rows for general case:
b(1);
c(1),b(2);
b(1),c(1),b(3);
c(2),b(2),c(1),b(4);
b(1),c(2),b(3),c(1),b(5);
c(3),b(2),c(2),b(4),c(1),b(6);
b(1),c(3),b(3),c(2),b(5),c(1),b(7);
c(4),b(2),c(3),b(4),c(2),b(6),c(1),b(8);
. . .
Row number r contains r numbers.
If r is odd  b(1),c((r-1)/2),b(3),c((r-1)/2-1),b(5),c((r-1)/2-2),...c(1),b(r).
If r is even c(r/2),b(2),c(r/2-1),b(4),c(r/2-2),b(6),...c(1),b(r).
The start of the sequence as table for b(n)=n and c(k)=k:
1..1..1..2..1..3..1..4...
2..1..2..2..2..3..2..4...
3..1..3..2..3..3..3..4...
4..1..4..2..4..3..4..4...
5..1..5..2..5..3..5..4...
6..1..6..2..6..3..6..4...
7..1..7..2..7..3..7..4...
8..1..8..2..8..3..8..4...
. . .
The start of the sequence as triangle array read by rows for b(n)=n and c(k)=k:
1;
1,2;
1,1,3;
2,2,1,4;
1,2,3,1,5;
3,2,2,4,1,6;
1,3,3,2,5,1,7;
4,2,3,4,2,6,1,8;
. . .
Row number r contains r numbers.
If r is odd  1,(r-1)/2,3,(r-1)/2-1,5,(r-1)/2-2,...1,r.
If r id even r/2,2,r/2-1,4,r/2-1,6,...1,r.
		

Crossrefs

Programs

  • Python
    def a(n):
        t=int((math.sqrt(8*n-7) - 1)/ 2)
        i=n-t*(t+1)//2
        j=(t*t+3*t+4)//2-n
        return (1+(-1)**j)*j//4 - (-1+(-1)**j)*i//2

Formula

For the general case
As table T(n,k) = (1+(-1)^k)*c(k/2)/2 - (-1+(-1)^k)*b(n)/2.
As linear sequence
a(n) = (1+(-1)^j)*c(j/2)/2 - (-1+(-1)^j)*b(i)/2, where i = n-t*(t+1)/2, j = (t*t+3*t+4)/2-n, t = floor((-1+sqrt(8*n-7))/2).
For b(n) = n and c(k) = k:
As table T(n,k) = (1+(-1)^k)*k/4 - (-1+(-1)^k)*n/2.
As linear sequence a(n) = (1+(-1)^A004736(n))*A004736(n)/4 - (-1+(-1)^A004736(n))*A002260(n)/2. a(n) = (1+(-1)^j)*j/4 - (-1+(-1)^j)*i/2,
where i = n-t*(t+1)/2, j = (t*t+3*t+4)/2-n, t = floor((-1+sqrt(8*n-7))/2).