Problem: Fill all the cells using distinct numbers from <1,25> set, so that sum of two adjacent cells is a square number.
(source: http://grymat.im.pwr.wroc.pl/etap1/zad1etp1213.pdf; numbers 20 and 13 have been given)
I've already solved this problem analytically and now I would like to approach it using an algorithm.
I would like to know how should I approach these kind of problems in general (not a solution, just a point for me to start).