Playing with Scala

faster while-loops vs for-loops; re-using array in inner loop