added algorithm to do faster pow(m,n)