Permutations of N Objects (+Travelling Salesman Problem)

https://www.desmos.com/calculator/udsi7kyfwc

The order function in the graph orders n objects according to a numbering system:

Number: Ordering:
1 1234
2 1243
3 1324
4 1342
5 1423
... ...

The function "d" takes an order and finds the distance it would take to travel between the objects indicated in the x1-y1 table

Then, I calculate the best cycle and path between the objects. A cycle is a travel that ends in the same place as it begins, and a path is a travel that only needs to go to all the "cities," or points.