The truths is: COM error are errors. (sounds nonsense but its true)
If you cant find the string in the registry than it isnt registered!!! :-O
Fix it! => Run the register as admin and check the error code. It must be NULL.
You better write:
HRESULT hr = ptr.CreateInstance(TEXT("Server.Maths"));
Consider studying this fine article
COM in plain C to better understand it. It is an outstanding article!!!