## Thursday, May 15, 2014

### Is there a 4-sided magic star?

In the last week I recalled one of the problems I solved nearly 20+ years back about 6-sided stars wherein I can fill numbers 1..12 such that each side sums to a same constant. That was during the time I was practicing the use of ProLog (aka Programming Logic) and the solution involved dynamic programming with recursion.

I retraced and built a solution generator for 6-sided stars this week using C# this time. More on that later. Then I started playing with solution generators for other sided stars. I was looking at the 4-sided star. Here is how the 4-sided star looks like:
There are 8 vertices A..H as indicated. there are 4 sides as indicated by the colored lines. Each line touches 4-vertices. Now can we fill the numbers 1..8 such that the sum on each line is the same constant? Short answer is: NO.

And here is a proof.

Given numbers 1..8, we want to have the numbers filled out such that the following conditions are met
1: A+B+C+D=V
2: E+C+F+G=V
3: D+F+H+A=V
4: G+H+B+E=V
let us sum up the equations 1&3 which produces following:
5:A+B+C+D+D+F+H+A=2A+2 D+B+C+F+H=2V
OR
6:2A+2D=2V −(BCFH)

Similarly summing up the equations of 2&4 produces following:
7:E+C+F+G+G+H+B+E=2E+2G+BCFH=2V
OR
8:2E+2G=2V −(BCFH)

Putting 6 & 8 together we have
9:2A+2D=2 E+2G
OR
10:A+D=E+G

Now take #1 and substitute using #10
11:A+B+C+D=E+B+C+G=V
And using #2 we find that
12:E+B+C+G=E+C+F+G
OR
We need
13:B=F
Using the above steps 5-13, we will also find that we need
14:C=H

Oops! That is a hard one. We cannot have the same number be filled in both places.
Since either #13 or #14 is possible, we do not have a valid solution for filling in the 4-sided star to ensure numbers add up to same value on 4-sides.