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.

A375972 a(n) = binomial(n,k(n)), where k(2) = 1, k(n) = k(n-1) + (a(n-1) mod 2).

Original entry on oeis.org

2, 3, 6, 10, 15, 35, 70, 126, 210, 330, 495, 1287, 3003, 6435, 12870, 24310, 43758, 75582, 125970, 203490, 319770, 490314, 735471, 2042975, 5311735, 13037895, 30421755, 67863915, 145422675, 300540195, 601080390, 1166803110, 2203961430, 4059928950, 7307872110, 12875774670, 22239974430
Offset: 2

Views

Author

Walter Robinson, Sep 04 2024

Keywords

Comments

A way to travel down the Pascal's triangle starting in the center of the third row, where you turn left at every even number, and turn right at every odd number, while descending a row at every step.
Pascal's triangle is symmetric, thus switching the turn directions would not change the sequence.

Examples

			a(3) = 3, and k(3) = 1.
To derive a(4), we first find that k(4) = k(3) + (a(3) mod 2) = 1 + (3 mod 2) = 2.
Therefore a(4) = binomial(4,k(4)) = binomial(4,2) = 6.
		

Crossrefs

Cf. A007318.
Initial conditions of n=0, k(0)=0 would generate A000012.

Programs

  • Maple
    k[2]:= 1:
    for n from 2 to 50 do
      a[n]:= binomial(n, k[n]);
      k[n+1]:= k[n] + (a[n] mod 2);
    od:
    seq(a[n],n=2..50); # Robert Israel, Jan 27 2025
  • Mathematica
    Module[{k}, FoldList[{Binomial[#2, k = #[[2]] + Mod[#[[1]], 2]], k} &, {2, 1}, Range[3, 50]][[All, 1]]] (* Paolo Xausa, Jan 28 2025 *)
  • PARI
    lista(nn) = my(va=vector(nn), vk=vector(nn)); vk[2] = 1; va[2] = binomial(2, vk[2]); for (n=3, nn, vk[n] = vk[n-1] + va[n-1] % 2; va[n] = binomial(n, vk[n]);); vector(nn-1, k, va[k+1]); \\ Michel Marcus, Sep 27 2024
  • Python
    def genNextRow(arr):
        nextRow = []
        nextRow.append(arr[0])
        for i in range(1, len(arr)):
            nextRow.append(arr[i-1]+arr[i])
        nextRow.append(arr[len(arr)-1])
        return nextRow
    pascal = [[1],[1,1]]
    n = 0
    index = 1
    while n < 30:
        pascal.append(genNextRow(pascal[1]))
        pascal.pop(0)
        print(pascal[1][index])
        index = index + (pascal[1][index] % 2)
        n += 1
    

Extensions

More terms from Michel Marcus, Sep 30 2024