Works for smaller numbers but too slow for big ones
MUCH faster