Yes, but your comment made me realize that we don't actually want sqrt(N1*N2) when N1 != N2.  We actually want max(N1,N2).  I just fixed this.