The puzzle is from the Math Pickle site and is explained here.
There is also a video on the subject on the Numberphile channel. Optimal solutions can be seen at 2 minutes.
Additionally, optimal solution can be seen here (plugin required)