Abstract
An optimal constant-composition or constant-weight code of weight omega has linear size if and only if its distance d is at least 2 omega - 1. When d >= 2 omega, the determination of the exact size of such a constant-composition or constant-weight code is trivial, but the case of d = 2 omega - 1 has been solved previously only for binary and ternary constant-composition and constant-weight codes, and for some sporadic instances. This paper provides a construction for quasicyclic optimal constant-composition and constant-weight codes of weight omega and distance 2 omega - 1 based on a new generalization of difference triangle sets. As a result, the sizes of optimal constant-composition codes and optimal constant-weight codes of weight omega and distance 2 omega - 1 are determined for all such codes of sufficiently large lengths. This solves an open problem of Etzion. The sizes of optimal constant-composition codes of weight omega and distance 2 omega - 1 are also determined for all omega <= 6, except in two cases.