prob023: magic hexagon

proposed by Toby Walsh
tw@cs.york.ac.uk

Specification

A magic hexagon consists of the number 1 to 19 arranged in a hexagonal pattern:

A,B,C
D,E,F,G
H,I,J,K,L
M,N,O,P
Q,R,S

We have a constraint that all diagonals sum to 38. That is, A+B+C = D+E+F+G = ... = Q+R+S = 38, A+D+H = B+E+I+M = ... = L+P+S = 38, C+G+L = B+F+K+P = ... = H+M+Q = 38.

The problem can be generalized to other sizes. This is the diameter 5 problem.