Within the framework of Dyson-Schwinger equations (DSEs), we discuss the equation of state (EOS) and quark number densities of 2 + 1 flavors, that is to say, u, d, and a quarks. The chemical equilibrium and electric charge neutrality conditions are used to constrain the chemical potential of different quarks. The EOS in the cases of 2 flavors and 2 + 1 flavors are discussed, and the quark number densities, the pressure, and energy density per baryon are also studied. The results show that there is a critical chemical potential for each flavor of quark, at which the quark number density turns to nonzero from 0; and furthermore, the system with 2 + 1 flavors of quarks is more stable than that with 2 flavors in the system. These discussions may provide some useful in to some research fields, such as the studies related to the QCD phase transitions or compact stars.