Math whiz, 13, earns 1st class honours degree in spare time