Storage capacity and optimal learning of Potts-model perceptrons by a cavity method | Synapse