quick sort optimization
Euler Problem 15