Well, without a doubt the junior programmer's productivity would improve by working closely with a senior programmer.
As for the senior programmer's productivity, that depends: if he is currently working near peak efficiency, having a junior programmer in his way will slow him down; if he is having motivational problems (as you implied in the earlier phrasing), having a junior programmer around may help him focus his attention, and achieve more.