P

R

O

G

R

A

M

M

I

N

G

 

C

O

M

P

E

T

I

T

I

O

N

 

Magic Star Numbers

Task #15

Advanced

18 Points

Task Description
This is a magic number puzzle.  You are given a six-pointed star as shown in the illustration below.  You must assign a unique value from 5 to 16 at each line intersection in the star, with A = 5.  What number assignments result in all sums along any straight line equaling 42?  For instance A + G + H + C = 42, C + I + J + E = 42 etc.

Your task is to write a program that will find all the answers to this puzzle.  Mirror versions of an answer are considered a different answer.

Program Input
None.

Program Output
The program screen output should look like what follows.  The program should list the title, a “.” for every 100,000 possible solutions checked, each answer as it is found on a separate line, the number of solutions checked and the total number of answers found at the end of the program.

Magic Star Number Solutions

………some number of periods………

Solution 1: A=5 B=7 C=6 D=8 E=13 F=9 G=16 H=15 I=12 J=11 K=14 L=10

………the rest of the solutions and periods………

Total solutions checked = ??

Total solutions found = ??

The Program should also write the answers to a file, one solution per line, values separated by commas, with the solution # as the first item and the numbers for the solution in A to L order following, as shown below.

1,5,7,6,8,13,9,16,15,12,11,14,10