We study the N=1* supersymmetric gauge theories with gauge groups Sp(2n) and SO(2n+1). These theories are obtained from the corresponding N=4 supersymmetric Yang-Mills theories via a mass deformation. We show that the number of quantum vacua in the Sp(2n) theory is equal to the number of quantum vacua in the SO(2n+1) theory. This constitutes non-trivial support for S-duality between these theories. The verification of the equality of the number of quantum vacua involves a rather esoteric identity due to Ramanujan.