During 1840, Riemann went to Hanover to live with his grandmother and attend lyceum (middle school years). After the death of his grandmother in 1842, he attended high school at the Johanneum Lüneburg. In high school, Riemann studied the Bible intensively, but he was often distracted by mathematics. His teachers were amazed by his ability to perform complicated mathematical operations, in which he often outstripped his instructor's knowledge. In 1846, at the age of 19, he started studying philology and Christian theology in order to become a pastor and help with his family's finances.
