The neutron yield for compact accelerator driven neutron sources depends on the target material, the ion type and its energy. When such sources are operated with low energy proton beams below 30 MeV, typical target materials are lithium and beryllium. New developments indicate that higher energies or a deuteron beam might be useful to increase the neutron yield at constant accelerator power. Here we present the total neutron yield analytically calculated for protons and deuterons at energies up to 100 MeV for various target materials. The total neutron yield depends on the involved cross sections and the stopping power of the target material. This study shows that for energies lower than 30 MeV light target materials with a deuteron beam are preferable whereas for energies above 30 MeV heavy target materials show a high neutron yield with little difference for a proton or deuteron beam