validity check, similar to the best.R function
best-worst cases handled
common and boundary cases for the num argument are handled