CGF :=
proc(n, k)
option remember;
local G;

    G := add(2^binomial(q,2)*z^q/q!, q=0..n);
    n!*coeftayl(log(G)^k/k!, z=0, n);
end;

C :=
proc(n, k)
option remember;

    if k = 0 and n = 0 then return 1 fi;
    if k = 0 or n = 0 then return 0 fi;

    add(binomial(n-1,q)*C(q,k-1)*2^binomial(n-q,2),
        q=0..n-1)
    - add(binomial(n-1,q)*C(q+1,k)*2^binomial(n-1-q,2),
          q=0..n-2);
end;

OEIS := mx -> seq(seq(C(n,k), k=1..n), n=1..mx);

BFILE :=
proc(mx)
local fname, fd, n, k, idx;

    fname := sprintf("conn-k-compB-%a.txt", mx);
    fd := fopen(fname, WRITE);

    idx := 1;
    for n to mx do
        for k to n do
            fprintf(fd, "%a %a\n", idx, C(n, k));
            idx := idx + 1;
        od;
    od;

    fclose(fd);

    return idx;
end;