Greatly simplified with exponent calculation of only desired value
Define squares on the board, not the magic number