Told he would die by 23, the theoretical physicist found an unlikely outlet for coping.