@*Intro. Find a comma-free block code of length \$n\$, having one code in each cyclic equivalence class, if one exists. Codewords are represented as hexadecimal numbers. @d maxn 25 /* must be at most 32, to keep the variable names small */ @c #include #include int n; /* command-line parameter */ char a[maxn+1]; main(int argc,char*argv[]) { register int i,j,k; register unsigned int x,y,z; register unsigned long long m,acc,xy; @; @; @; } @ @= if (argc!=2 || sscanf(argv[1],"%d",&n)!=1) { fprintf(stderr,"Usage: %s n\n",argv[0]); exit(-1); } if (n<2 || n>maxn) { fprintf(stderr,"n should be between 2 and %d, not %d!\n",maxn,n); exit(-2); } printf("~ sat-commafree %d\n",n); @ Here I use Algorithm 7.2.1.1F to find the prime binary strings. @= f1: a[0]=-1, j=1; f2:@+if (j==n) @; f3:@+for (j=n;a[j]==1;j--); f4:@+if (j) { a[j]=1; f5:@+for (k=j+1;k<=n;k++) a[k]=a[k-j]; goto f2; } @ @= { for (i=0;i= m=(1LL<; for (y=0;y<(1<; @; } } @ @= acc=(((unsigned long long)x)<>k)&m)==x) break; if (k= acc=(((unsigned long long)y)<>k)&m)==y) break; if (k= acc=(((unsigned long long)z)<>k)&m)==z) break; if (k= xy=(((unsigned long long)x)<>j)&m; @; printf("~%x ~%x ~%x\n", x,y,z); } @*Index.