Abstract Based on the analysis of the defect of the RPCL, a new competitive learning algorithm is proposed. In the new algorithm the data density is introduced, and the modification of the weights is taken into account to surmount the defect of the RPCL. It is shown by the theoretical analysis and experimental results that the new algorithm can automatically select the appropriate number of the clusters in a data set, and improve the clustering accuracy and convergence speed.