runs in 19.09 seconds on my system, yet when the Length[Union[b]] == 3 is changed to Length[Union[b]] >= 3 the execution time increases to 164.54 seconds almost 9 times slower. It seems disproportionate to me. Perhaps some one could test it to see if its accurate.
Thanks David and llian, I now see where the difference comes from, regarding the N[n] that certainly speeded it up, the timings went down to 8.61 and 51.76 respectively.