login
A174294
Triangle T(n,k), read by rows, T(n,k) = (T(n-1,k-1) + T(n-2,k-1)) - (T(n-1,k) + T(n-2,k)), with T(n, 0) = T(n, k) = 1 and T(n, 1) = (n mod 2).
6
1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, -1, 0, 1, 1, 0, 0, 2, -2, 0, 1, 1, 1, 0, 0, 3, -3, 0, 1, 1, 0, 1, -2, 1, 4, -4, 0, 1, 1, 1, 0, 3, -6, 3, 5, -5, 0, 1, 1, 0, 0, 0, 6, -12, 6, 6, -6, 0, 1, 1, 1, 1, -3, 3, 9, -20, 10, 7, -7, 0, 1, 1, 0, 0, 4, -12, 12, 11, -30, 15, 8, -8, 0, 1
OFFSET
0,25
FORMULA
T(n,k) = (T(n-1,k-1) + T(n-2,k-1)) - (T(n-1,k) + T(n-2,k)), with T(n, 0) = T(n, k) = 1 and T(n, 1) = (n mod 2).
EXAMPLE
Table begins:
n\k|...0...1...2...3...4...5...6...7...8...9..10
---|--------------------------------------------
0..|...1
1..|...1...1
2..|...1...0...1
3..|...1...1...0...1
4..|...1...0...0...0...1
5..|...1...1...1..-1...0...1
6..|...1...0...0...2..-2...0...1
7..|...1...1...0...0...3..-3...0...1
8..|...1...0...1..-2...1...4..-4...0...1
9..|...1...1...0...3..-6...3...5..-5...0...1
10.|...1...0...0...0...6.-12...6...6..-6...0...1
MATHEMATICA
T[n_, k_]:= T[n, k]= If[k<0 || k>n, 0, If[k==0 || k==n, 1, If[k==1, Mod[n, 2], T[n-1, k-1] +T[n-2, k-1] -T[n-1, k] -T[n-2, k] ]]];
Table[T[n, k], {n, 0, 15}, {k, 0, n}]//Flatten (* G. C. Greubel, Nov 25 2021 *)
PROG
(Sage)
@CachedFunction
def T(n, k): # A174294
if (k<0 or k>n): return 0
elif (k==0 or k==n): return 1
elif (k==1): return n%2
else: return T(n-1, k-1) + T(n-2, k-1) - T(n-1, k) - T(n-2, k)
flatten([[T(n, k) for k in (0..n)] for n in (0..15)]) # G. C. Greubel, Nov 25 2021
CROSSREFS
KEYWORD
sign,tabl
AUTHOR
Mats Granvik, Mar 15 2010
STATUS
approved