login
A180009
Triangle T(n,k), read by rows, T(n,1) = mu(n), T(n,2) = T(n,k-1) - T(n-1,k), k > 2, T(n,k) = Sum_{i=1..k-1} ( T(n-i,k-1) - T(n-i,k) ).
2
1, -1, -1, -1, 0, -1, 0, 0, 0, -1, -1, -1, 1, 0, -1, 1, 2, -2, 1, 0, -1, -1, -3, 2, -1, 1, 0, -1, 0, 3, -1, 1, -1, 1, 0, -1, 0, -3, -1, -2, 2, -1, 1, 0, -1, 1, 4, 2, 2, -3, 2, -1, 1, 0, -1, -1, -5, 0, -1, 1, -2, 2, -1, 1, 0, -1, 0, 5, -3, 2, 1, 0, -2, 2, -1, 1, 0, -1, -1, -6, 3, -4, 0, 0, 1, -2, 2, -1, 1, 0, -1
OFFSET
1,17
EXAMPLE
Table begins:
1;
-1, -1;
-1, 0, -1;
0, 0, 0, -1;
-1, -1, 1, 0, -1;
1, 2, -2, 1, 0, -1;
-1, -3, 2, -1, 1, 0, -1;
0, 3, -1, 1, -1, 1, 0, -1;
0, -3, -1, -2, 2, -1, 1, 0, -1;
1, 4, 2, 2, -3, 2, -1, 1, 0, -1;
-1, -5, 0, -1, 1, -2, 2, -1, 1, 0, -1;
0, 5, -3, 2, 1, 0, -2, 2, -1, 1, 0, -1;
-1, -6, 3, -4, 0, 0, 1, -2, 2, -1, 1, 0, -1;
1, 7, -1, 3, 0, 2, -1, 1, -2, 2, -1, 1, 0, -1;
1, -6, -1, -2, -2, -3, 1, 0, 1, -2, 2, -1, 1, 0, -1;
MAPLE
T:= proc(n, k) option remember;
if k<1 or k>n then 0
elif k=1 then NumberTheory[Moebius](n)
elif k=2 then T(n, k-1) - T(n-1, k)
else add( T(n-j, k-1) - T(n-j, k), j=1..k-1 )
fi; end;
seq(seq( T(n, k), k=1..n), n=1..15); # G. C. Greubel, Dec 17 2019
MATHEMATICA
T[n_, k_]:= T[n, k]= If[k<1 || k>n, 0, If[k==1, MoebiusMu[n], If[k==2, T[n, k-1] - T[n-1, k], Sum[T[n-j, k-1] - T[n-j, k], {j, k-1}]]]]; Table[T[n, k], {n, 15}, {k, n}]//Flatten (* G. C. Greubel, Dec 17 2019 *)
PROG
(PARI) T(n, k) = if(k<1 || k>n, 0, if(k==1, moebius(n), if(k==2, T(n, k-1) - T(n-1, k), sum(j=1, k-1, T(n-j, k-1) - T(n-j, k)) ))); \\ G. C. Greubel, Dec 17 2019
(Magma)
function T(n, k)
if k lt 1 or k gt n then return 0;
elif k eq 1 then return MoebiusMu(n);
elif k eq 2 then return T(n, k-1) - T(n-1, k);
else return (&+[T(n-j, k-1) - T(n-j, k): j in [1..k-1]]);
end if; return T; end function;
[T(n, k): k in [1..n], n in [1..15]]; // G. C. Greubel, Dec 17 2019
(Sage)
@CachedFunction
def T(n, k):
if (k<1 or k>n): return 0
elif (k==1): return moebius(n)
elif (k==2): return T(n, k-1) - T(n-1, k)
else: return sum(T(n-j, k-1) - T(n-j, k) for j in (1..k-1))
[[T(n, k) for k in (1..n)] for n in (1..15)] # G. C. Greubel, Dec 17 2019
(GAP)
T:= function(n, k)
if k<1 or k>n then return 0;
elif k=1 then return MoebiusMu(n);
elif k=2 then return T(n, k-1) - T(n-1, k);
else return Sum([1..k-1], j-> T(n-j, k-1) - T(n-j, k) );
fi; end;
Flat(List([1..15], n-> List([1..n], k-> T(n, k) ))); # G. C. Greubel, Dec 17 2019
CROSSREFS
Sequence in context: A060572 A163543 A358095 * A341907 A180010 A287401
KEYWORD
sign,tabl
AUTHOR
Mats Granvik, Aug 06 2010
STATUS
approved