The Reasoning-Memorization Interplay in Language Models Is Mediated by a Single Direction