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

%I #20 Sep 30 2024 14:15:37

%S 2,3,6,10,15,35,70,126,210,330,495,1287,3003,6435,12870,24310,43758,

%T 75582,125970,203490,319770,490314,735471,2042975,5311735,13037895,

%U 30421755,67863915,145422675,300540195,601080390,1166803110,2203961430,4059928950,7307872110,12875774670,22239974430

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

%C 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.

%C Pascal's triangle is symmetric, thus switching the turn directions would not change the sequence.

%e a(3) = 3, and k(3) = 1.

%e To derive a(4), we first find that k(4) = k(3) + (a(3) mod 2) = 1 + (3 mod 2) = 2.

%e Therefore a(4) = binomial(4,k(4)) = binomial(4,2) = 6.

%o (Python)

%o def genNextRow(arr):

%o nextRow = []

%o nextRow.append(arr[0])

%o for i in range(1, len(arr)):

%o nextRow.append(arr[i-1]+arr[i])

%o nextRow.append(arr[len(arr)-1])

%o return nextRow

%o pascal = [[1],[1,1]]

%o n = 0

%o index = 1

%o while n < 30:

%o pascal.append(genNextRow(pascal[1]))

%o pascal.pop(0)

%o print(pascal[1][index])

%o index = index + (pascal[1][index] % 2)

%o n += 1

%o (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

%Y Cf. A007318.

%Y Initial conditions of n=0, k(0)=0 would generate A000012.

%K nonn

%O 2,1

%A _Walter Robinson_, Sep 04 2024

%E More terms from _Michel Marcus_, Sep 30 2024