with(LinearAlgebra);
Diag1:=proc(n)
f := (r, s) -> (s - 1)^(r - 1);
M := Matrix(n + 1, f);
g := m -> n^(m - 1)/(2*m - 1); 
K := Matrix(n + 1, 1, g); 
A := MatrixMatrixMultiply(MatrixInverse(M), K); 
S := ilcm(seq(denom(A[m, 1]), m = 1 .. n + 1));
A[2, 1]*S; 
end;
seq(Diag1(n),n=1..40);