OFFSET
2,1
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.
EXAMPLE
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.
PROG
(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
(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
CROSSREFS
KEYWORD
nonn
AUTHOR
Walter Robinson, Sep 04 2024
EXTENSIONS
More terms from Michel Marcus, Sep 30 2024
STATUS
approved