login
A026568
Irregular triangular array T read by rows: T(i,0) = T(i,2i) = 1 for i >= 0; T(i,1) = T(i,2i-1) = [ (i+1)/2 ] for i >= 1; and for i >= 2 and 2 <=j <= i - 2, T(i,j) = T(i-1,j-2) + T(i-1,j-1) + T(i-1,j) if i + j is even, T(i,j) = T(i-1,j-2) + T(i-1,j) if i + j is odd.
25
1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 2, 4, 5, 4, 2, 1, 1, 2, 7, 7, 13, 7, 7, 2, 1, 1, 3, 8, 16, 20, 27, 20, 16, 8, 3, 1, 1, 3, 12, 19, 44, 43, 67, 43, 44, 19, 12, 3, 1, 1, 4, 13, 34, 56, 106, 111, 153, 111, 106, 56, 34, 13, 4, 1, 1, 4, 18, 38, 103, 140, 273
OFFSET
1,7
COMMENTS
T(n, k) = number of strings s(0)..s(n) such that s(0) = 0, s(n) = n - k, |s(i)-s(i-1)| <= 1 if s(i-1) is even, |s(i)-s(i-1)| = 1 if s(i-1) is odd, for 1 <= i <= n.
EXAMPLE
First 5 rows:
1
1 1 1
1 1 3 1 1
1 2 4 5 4 2 1
1 2 7 7 13 7 7 2 1
MATHEMATICA
z = 12; t[n_, 0] := 1; t[n_, 1] := Floor[(n + 1)/2]; t[n_, k_] := t[n, k] = Which[k == 2 n, 1, k == 2 n - 1, Floor[(n + 1)/2], EvenQ[n + k], t[n - 1, k - 2] + t[n - 1, k - 1] + t[n - 1, k], OddQ[n + k], t[n - 1, k - 2] + t[n - 1, k]]; u = Table[t[n, k], {n, 0, z}, {k, 0, 2 n}];
TableForm[u] (* A026568 array *)
Flatten[u] (* A026568 sequence *)
PROG
(PARI) T(k, n)=if(n<0||n>2*k, 0, if(n==0||n==2*k, 1, if(k>0&&(n==1||n==2*k-1), (k+1)\2, T(k-1, n-2)+T(k-1, n)+if((k+n)%2==0, T(k-1, n-1))))) \\ Ralf Stephan
CROSSREFS
Cf. T(n,n) is A026569.
Sequence in context: A242222 A247198 A305319 * A138361 A030408 A226048
KEYWORD
nonn,tabf
EXTENSIONS
Updated by Clark Kimberling, Aug 28 2014
STATUS
approved