Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #31 Jun 30 2024 09:10:04
%S 1,1,1,1,2,1,1,4,4,1,1,5,8,5,1,1,7,13,13,7,1,1,8,20,26,20,8,1,1,10,28,
%T 46,46,28,10,1,1,11,38,74,92,74,38,11,1,1,13,49,112,166,166,112,49,13,
%U 1,1,14,62,161,278,332,278,161,62,14,1,1,16,76,223,439,610,610,439,223,76,16,1
%N Triangular array T read by rows: T(n,0) = T(n,n) = 1 for n >= 0, T(n,1) = T(n,n-1) = floor((3*n-1)/2) for n >= 1, otherwise T(n,k) = T(n-1,k-1) + T(n-1,k) for 2 <= k <= n-2, n >= 4.
%C T(n, k) = number of paths from (0, 0) to (n-k, k) in directed graph having vertices (i, j) and edges (i, j)-to-(i+1, j) and (i, j)-to-(i, j+1) for i, j >= 0 and edges (i, j)-to-(i+1, j+1) for i=0, j >= 1 and odd and for j=0, i >= 1 and odd.
%C See A228053 for a sequence with many terms in common with this one. - _T. D. Noe_, Aug 07 2013
%H Reinhard Zumkeller, <a href="/A026637/b026637.txt">Rows n = 0..100 of table, flattened</a>
%F From _G. C. Greubel_, Jun 28 2024: (Start)
%F T(n, n-k) = T(n, k).
%F T(2*n-1, n-1) = A026641(n), n >= 1.
%F Sum_{k=0..n} T(n, k) = A026644(n).
%F Sum_{k=0..n} (-1)^k*T(n, k) = A000007(n). (End)
%e Triangle begins as:
%e 1;
%e 1, 1;
%e 1, 2, 1;
%e 1, 4, 4, 1;
%e 1, 5, 8, 5, 1;
%e 1, 7, 13, 13, 7, 1;
%e 1, 8, 20, 26, 20, 8, 1;
%e 1, 10, 28, 46, 46, 28, 10, 1;
%e 1, 11, 38, 74, 92, 74, 38, 11, 1;
%e 1, 13, 49, 112, 166, 166, 112, 49, 13, 1;
%e 1, 14, 62, 161, 278, 332, 278, 161, 62, 14, 1;
%p A026637 := proc(n,k)
%p option remember;
%p if k=0 or k=n then
%p 1
%p elif k=1 or k=n-1 then
%p floor((3*n-1)/2) ;
%p elif k <0 or k > n then
%p 0;
%p else
%p procname(n-1,k-1)+procname(n-1,k) ;
%p end if;
%p end proc: # _R. J. Mathar_, Apr 26 2015
%t T[n_, k_] := T[n, k] = Which[k == 0 || k == n, 1, k == 1 || k == n-1, Floor[(3n-1)/2], k < 0 || k > n, 0, True, T[n-1, k-1] + T[n-1, k]];
%t Table[T[n, k], {n, 0, 11}, {k, 0, n}] // Flatten (* _Jean-François Alcover_, Jan 30 2018 *)
%o (Haskell)
%o a026637 n k = a026637_tabl !! n !! k
%o a026637_row n = a026637_tabl !! n
%o a026637_tabl = [1] : [1,1] : map (fst . snd)
%o (iterate f (0, ([1,2,1], [0,1,1,0]))) where
%o f (i, (xs, ws)) = (1 - i,
%o if i == 1 then (ys, ws) else (zipWith (+) ys ws, ws'))
%o where ys = zipWith (+) ([0] ++ xs) (xs ++ [0])
%o ws' = [0,1,0,0] ++ drop 2 ws
%o -- _Reinhard Zumkeller_, Aug 08 2013
%o (Magma)
%o function T(n,k) // T = A026637
%o if k eq 0 or k eq n then return 1;
%o elif k eq 1 or k eq n-1 then return Floor((3*n-1)/2);
%o else return T(n-1, k) + T(n-1, k-1);
%o end if;
%o end function;
%o [T(n,k): k in [0..n], n in [0..15]]; // _G. C. Greubel_, Jun 28 2024
%o (SageMath)
%o def T(n,k): # T = A026637
%o if k==0 or k==n: return 1
%o elif k==1 or k==n-1: return ((3*n-1)//2)
%o else: return T(n-1, k) + T(n-1, k-1)
%o flatten([[T(n,k) for k in range(n+1)] for n in range(16)]) # _G. C. Greubel_, Jun 28 2024
%Y Cf. A026638, A026639, A026640, A026641, A026642, A026643, A026644.
%Y Cf. A026966, A026967, A026968, A026969, A026970, A228053.
%Y Sums include: A000007 (alternating sign row), A026644 (row), A026645, A026646, A026647 (diagonal).
%K nonn,tabl,easy
%O 0,5
%A _Clark Kimberling_