# Maple program for A005146 and A005147 written by Peter Luschny (peter(AT)luschny.de), Jan 10 2007
#___________________________________________________________________

qd := proc(LEN) local S,M,N,K,A,B,C;
  S := [seq((-1)^K*bernoulli(2*K+2)/((2*K+1)*(2*K+2)),K=0..LEN)]:
  M := array(1..LEN,1..LEN):
  for N to LEN   do M[N,1] := 0 od;
  for N to LEN-1 do M[N,2] := S[N+1]/S[N] od;
  for K from 3 to LEN do
    for N to LEN-K+1 do
      A := M[N+1,K-2]; B := M[N+1,K-1]; C := M[N,K-1];
      M[N,K] := `if`(type(K,odd), A+B-C, A*B/C);
    od;
  od;
  M[1,1] := S[1];
  [seq(M[1,K],K=1..LEN)]
end:
#__________________________________________________________________


# (Thanks to Rainer Rosenthal (r.rosenthal(AT)web.de) for sending this to the OEIS.)