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).

This page as a plain text file.
%I A375972 #29 Jan 28 2025 15:14:14
%S A375972 2,3,6,10,15,35,70,126,210,330,495,1287,3003,6435,12870,24310,43758,
%T A375972 75582,125970,203490,319770,490314,735471,2042975,5311735,13037895,
%U A375972 30421755,67863915,145422675,300540195,601080390,1166803110,2203961430,4059928950,7307872110,12875774670,22239974430
%N A375972 a(n) = binomial(n,k(n)), where k(2) = 1, k(n) = k(n-1) + (a(n-1) mod 2).
%C A375972 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 A375972 Pascal's triangle is symmetric, thus switching the turn directions would not change the sequence.
%H A375972 Robert Israel, <a href="/A375972/b375972.txt">Table of n, a(n) for n = 2..3418</a>
%e A375972 a(3) = 3, and k(3) = 1.
%e A375972 To derive a(4), we first find that k(4) = k(3) + (a(3) mod 2) = 1 + (3 mod 2) = 2.
%e A375972 Therefore a(4) = binomial(4,k(4)) = binomial(4,2) = 6.
%p A375972 k[2]:= 1:
%p A375972 for n from 2 to 50 do
%p A375972   a[n]:= binomial(n, k[n]);
%p A375972   k[n+1]:= k[n] + (a[n] mod 2);
%p A375972 od:
%p A375972 seq(a[n],n=2..50); # _Robert Israel_, Jan 27 2025
%t A375972 Module[{k}, FoldList[{Binomial[#2, k = #[[2]] + Mod[#[[1]], 2]], k} &, {2, 1}, Range[3, 50]][[All, 1]]] (* _Paolo Xausa_, Jan 28 2025 *)
%o A375972 (Python)
%o A375972 def genNextRow(arr):
%o A375972     nextRow = []
%o A375972     nextRow.append(arr[0])
%o A375972     for i in range(1, len(arr)):
%o A375972         nextRow.append(arr[i-1]+arr[i])
%o A375972     nextRow.append(arr[len(arr)-1])
%o A375972     return nextRow
%o A375972 pascal = [[1],[1,1]]
%o A375972 n = 0
%o A375972 index = 1
%o A375972 while n < 30:
%o A375972     pascal.append(genNextRow(pascal[1]))
%o A375972     pascal.pop(0)
%o A375972     print(pascal[1][index])
%o A375972     index = index + (pascal[1][index] % 2)
%o A375972     n += 1
%o A375972 (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 A375972 Cf. A007318.
%Y A375972 Initial conditions of n=0, k(0)=0 would generate A000012.
%K A375972 nonn
%O A375972 2,1
%A A375972 _Walter Robinson_, Sep 04 2024
%E A375972 More terms from _Michel Marcus_, Sep 30 2024