  The problem to construct optimal conflict-avoiding codes of even lengths and
the Hamming weight $3$ is completely settled. On the contrary, it is still open
for odd lengths. It turns out that the prime lengths are the fundamental cases
needed to be constructed. In the article, we study conflict-avoiding codes of
prime lengths and give a connection with the so-called cyclotomic numbers. By
having some nonzero cyclotomic numbers, a well-known algorithm for constructing
optimal conflict-avoiding codes will work for certain prime lengths. As a
consequence, we are able to answer the size of optimal conflict-avoiding code
for a new class of prime lengths.
