We have studied the electronic and magnetic properties of the Si and Ga substituted Nd2Fe17 compounds by means of first-principles calculations. The results show that for the Nd2Fe17-xSix (x=1,2,3, and 4) series, the total Fe moments per cell decrease as x increases but the average local Fe moments actually increase up to x=3, except for the 18h site which is the most preferable site for substitution. For Nd2Fe15Ga2, the moments on every Fe site increase. These results are also compared with the earlier calculation on Nd2Fe17-xAlx (x=1,2, and 4). From the spin-polarized density of states (DOS) and local DOS for Si, Al, and Ga, it is shown that different substituting elements can change the electronic structure of Nd2Fe17 crystal substantially because of the slightly different interactions with the Fe atoms, and the change in the lattice constants. Estimation of Curie temperatures based on the spin-fluctuation model shows qualitative agreement with experiments. (C) 1996 American Institute of Physics.