Apparatus for producing a mass-coded set of compounds of the general formula X(Y)n, wherein X is a scaffold, n is from 2 to about 6, and each Y is, independently, a peripheral moiety, comprising a digital processor assembly for selecting a peripheral moiety precursor subset from a peripheral moiety precursor set, said subset comprising a sufficient number of peripheral moiety precursors that there exist at least about 250 distinct combinations of n peripheral moieties derived from said subset, wherein at least about 90% of said combinations of n peripheral moieties derived from said subset have molecular mass sums which are distinct from the molecular mass sums of all other combinations of n peripheral moieties derived from said subset.