login
A026637
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.
17
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, 46, 46, 28, 10, 1, 1, 11, 38, 74, 92, 74, 38, 11, 1, 1, 13, 49, 112, 166, 166, 112, 49, 13, 1, 1, 14, 62, 161, 278, 332, 278, 161, 62, 14, 1, 1, 16, 76, 223, 439, 610, 610, 439, 223, 76, 16, 1
OFFSET
0,5
COMMENTS
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.
See A228053 for a sequence with many terms in common with this one. - T. D. Noe, Aug 07 2013
LINKS
FORMULA
From G. C. Greubel, Jun 28 2024: (Start)
T(n, n-k) = T(n, k).
T(2*n-1, n-1) = A026641(n), n >= 1.
Sum_{k=0..n} T(n, k) = A026644(n).
Sum_{k=0..n} (-1)^k*T(n, k) = A000007(n). (End)
EXAMPLE
Triangle begins as:
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, 46, 46, 28, 10, 1;
1, 11, 38, 74, 92, 74, 38, 11, 1;
1, 13, 49, 112, 166, 166, 112, 49, 13, 1;
1, 14, 62, 161, 278, 332, 278, 161, 62, 14, 1;
MAPLE
A026637 := proc(n, k)
option remember;
if k=0 or k=n then
1
elif k=1 or k=n-1 then
floor((3*n-1)/2) ;
elif k <0 or k > n then
0;
else
procname(n-1, k-1)+procname(n-1, k) ;
end if;
end proc: # R. J. Mathar, Apr 26 2015
MATHEMATICA
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]];
Table[T[n, k], {n, 0, 11}, {k, 0, n}] // Flatten (* Jean-François Alcover, Jan 30 2018 *)
PROG
(Haskell)
a026637 n k = a026637_tabl !! n !! k
a026637_row n = a026637_tabl !! n
a026637_tabl = [1] : [1, 1] : map (fst . snd)
(iterate f (0, ([1, 2, 1], [0, 1, 1, 0]))) where
f (i, (xs, ws)) = (1 - i,
if i == 1 then (ys, ws) else (zipWith (+) ys ws, ws'))
where ys = zipWith (+) ([0] ++ xs) (xs ++ [0])
ws' = [0, 1, 0, 0] ++ drop 2 ws
-- Reinhard Zumkeller, Aug 08 2013
(Magma)
function T(n, k) // T = A026637
if k eq 0 or k eq n then return 1;
elif k eq 1 or k eq n-1 then return Floor((3*n-1)/2);
else return T(n-1, k) + T(n-1, k-1);
end if;
end function;
[T(n, k): k in [0..n], n in [0..15]]; // G. C. Greubel, Jun 28 2024
(SageMath)
def T(n, k): # T = A026637
if k==0 or k==n: return 1
elif k==1 or k==n-1: return ((3*n-1)//2)
else: return T(n-1, k) + T(n-1, k-1)
flatten([[T(n, k) for k in range(n+1)] for n in range(16)]) # G. C. Greubel, Jun 28 2024
CROSSREFS
Sums include: A000007 (alternating sign row), A026644 (row), A026645, A026646, A026647 (diagonal).
Sequence in context: A176388 A282494 A156609 * A026659 A026386 A147532
KEYWORD
nonn,tabl,easy
STATUS
approved