Add find order of magnitude recursively and tests