See Numberphile's video and Wikipedia. Extract below.
A knight's tour is a sequence of moves of a knight on a chessboard such that the knight visits every square exactly once. If the knight ends on a square that is one knight's move from the beginning square (so that it could tour the board again immediately, following the same path), the tour is closed (or re-entrant); otherwise, it is open. The knight's tour problem is the mathematical problem of finding a knight's tour. Creating a program to find a knight's tour is a common problem given to computer science students. Variations of the knight's tour problem involve chessboards of different sizes than the usual 8 × 8, as well as irregular (non-rectangular) boards.
Find more information on my GitHub Page. Here you will find a Javascript file you can run to find all the solutions to this problem for 8x8 squares. As far as I can determine there are 19,591,828,170,979,904 ("nineteen quadrillion, five hundred ninety-one trillion, eight hundred twenty-eight billion, one hundred seventy million, nine hundred seventy-nine thousand, nine hundred four") solutions. The first 172227 you can find in the file "8x8-0,0.solutions.json" on the GitHub Page.
Although there are no magical solutions in the 8x8 squares board, there is also a Python script that uses a JSON-file (like 8x8-0,0.solutions.json) to find magical squares.
Please be patient so the script will find the first and draw an animation of the first few iterations.