How the brain learns mathematics