"Just for fun?" They were trying to figure out whether they could detonate nukes in space to blow up incoming ICBMs, which were a real and growing threat in 1962 (unlike anything to do with the Moon).
The "fun" part was a flippant attempt to point out that the US had, at enormous risk and cost, and with previous mistakes, launched an H-bomb into space over 50 years ago. The ICBM part is new to me -- any further info?
the moon has more gravitational potential energy in it than all the nukes on earth times one million