I'm still not 100% sure on whether or not a nuke in space would actually move an asteroid. It would definitely irradiate it, but would it move it?
The basis of my assertion is from this link here https://history.nasa.gov/conghand/nuclear.htm
When a nuclear weapon is detonated close to the Earth's surface the density of the air is sufficient to attenuate nuclear radiation (neutrons and gamma rays) to such a degree that the effects of these radiations are generally less important than the effects of blast and thermal radiation.
Short version is the blast and thermal (heat) released in an atmosphere is due to the presence of an atmosphere...the radiation of the blast interacts with the air and causes the extreme heat and concussive wave. Guess what doesn't exist in space?
If a nuclear weapon is exploded in a vacuum-i. e., in space-the complexion of weapon effects changes drastically:
First, in the absence of an atmosphere, blast disappears completely.
Second, thermal radiation, as usually defined, also disappears. There is no longer any air for the blast wave to heat and much higher frequency radiation is emitted from the weapon itself.
This is to say that a nuke in space generates a huge amount of radiation, but no concussive blast or heat (these 2 aspects are because of the nuke's interaction with the atmosphere). No atmosphere, no blast, no effects outside of extreme radiation. Potential that the radiation is enough energy to move the asteroid?...but our information on the subject is lacking and I believe is likely orders of magnitude less than the energy required to divert the asteroid.
As a side note - Gravity is likely the best method of moving these asteroids. Since the distance/time is so great, simply shadowing the asteroid with a large mass (a transport ship) might be enough to redirect the asteroid. Transport and asteroid interact (gravity) bring the two close together. Transport ship uses thrusters at an angle to move itself further away from the asteroid...repeat this for 50 years and the impact on the asteroids trajectory is significant.