Move AlgebraicNumber class to the core

fixes #8066
Merge pull request #8076 from skirpichev/8066-move-AlgebraicNumber

Move AlgebraicNumber class to the core