Added an optimal path. Scales like factorial(N), although sieving helps a lot.