The letters, A to L, within this star represent intersections of unique pairings of its 6 lines, and α, β, γ, δ, ε and ζ are sums of intersections defined as:
α = A + D + G + K β = E + G + J + L γ = K + J + I + H
δ = L + I + F + B ε = H + F + C + A ζ = B + C + D + E
A α
/ \
ζ B---C---D---E β
\ / \ /
F G
/ \ / \
ε H---I---J---K γ
\ /
L δ
Assign values from 1 to 12 to each of the locations A to L such that
each sum is an element of an arithmetic progression with an arithmetic difference of two (2) but not necessarily as adjacent vertex values.
Secondly, attempt the same task but with a difference of four (4) as the outcome.
And for a tease... can you offer a solution if all such vertex sums are equal, ie, 26?
Note:
Discounting rotations and reflections, more than one possibility exists for each of the first two tasks.
When the differences are 2, the totals are 21 through 31. The following program produces unique solutions as it requires that A+D+G+K be the one that adds to 21, and that A be less than K, removing the possibility of rotated or reflected variations of other solutions.
DIM taken(12)
tv(1) = 21: tv(2) = 23
tv(3) = 25: tv(4) = 27
tv(5) = 29: tv(6) = 31
FOR a = 1 TO tv(1) / 2
taken(a) = 1
FOR d = 1 TO tv(1) - 2 - a
IF d < 13 THEN
IF taken(d) = 0 THEN
taken(d) = 1
FOR g = 1 TO tv(1) - 1 - a - d
IF g < 13 THEN
IF taken(g) = 0 THEN
taken(g) = 1
k = tv(1) - a - d - g
IF k > a AND k < 13 THEN
IF taken(k) = 0 THEN
taken(k) = 1
REDIM tTaken(6)
tTaken(1) = 1
FOR b = 1 TO 12
IF taken(b) = 0 THEN
taken(b) = 1
FOR c = 1 TO 12
IF taken(c) = 0 THEN
taken(c) = 1
FOR e = 1 TO 12
IF taken(e) = 0 THEN
taken(e) = 1
total = b + c + d + e
validTot = 0
FOR i2 = 2 TO 6
IF tv(i2) = total THEN validTot = 1: EXIT FOR
NEXT
IF validTot THEN
IF tTaken(i2) THEN validTot = 0
END IF
IF validTot THEN
tTaken(i2) = 1
FOR h = 1 TO 12
IF taken(h) = 0 THEN
taken(h) = 1
FOR i = 1 TO 12
IF taken(i) = 0 THEN
taken(i) = 1
FOR j = 1 TO 12
IF taken(j) = 0 THEN
taken(j) = 1
total = h + i + j + k
validTot = 0
FOR i3 = 2 TO 6
IF tv(i3) = total THEN validTot = 1: EXIT FOR
NEXT
IF validTot THEN
IF tTaken(i3) THEN validTot = 0
END IF
IF validTot THEN
tTaken(i3) = 1
FOR f = 1 TO 12
IF taken(f) = 0 THEN
taken(f) = 1
FOR l = 1 TO 12
IF taken(l) = 0 THEN
taken(l) = 1
total = b + f + i + l
validTot = 0
FOR i4 = 2 TO 6
IF tv(i4) = total THEN validTot = 1: EXIT FOR
NEXT
IF validTot THEN
IF tTaken(i4) THEN validTot = 0
END IF
IF validTot THEN
tTaken(i4) = 1
total = h + f + c + a
validTot = 0
FOR i5 = 2 TO 6
IF tv(i5) = total THEN validTot = 1: EXIT FOR
NEXT
IF validTot THEN
IF tTaken(i5) THEN validTot = 0
END IF
IF validTot THEN
tTaken(i5) = 1
total = l + j + g + e
validTot = 0
FOR i6 = 2 TO 6
IF tv(i6) = total THEN validTot = 1: EXIT FOR
NEXT
IF validTot THEN
IF tTaken(i6) THEN validTot = 0
END IF
IF validTot THEN
tTaken(i6) = 1
PRINT a; b; c; d; e; f; g; h; i; j; k; l
ct = ct + 1
tTaken(i6) = 0
END IF
tTaken(i5) = 0
END IF
tTaken(i4) = 0
END IF
taken(l) = 0
END IF
NEXT l
taken(f) = 0
END IF
NEXT f
tTaken(i3) = 0
END IF 'validTot
taken(j) = 0
END IF
NEXT j
taken(i) = 0
END IF
NEXT i
taken(h) = 0
END IF
NEXT h
tTaken(i2) = 0
END IF 'validTot
taken(e) = 0
END IF
NEXT e
taken(c) = 0
END IF
NEXT c
taken(b) = 0
END IF
NEXT b
taken(k) = 0
END IF
END IF
taken(g) = 0
END IF
END IF
NEXT g
taken(d) = 0
END IF
END IF
NEXT d
taken(a) = 0
NEXT a
PRINT ct
The above program finds 13,728 solutions. To narrow that down, I added code to make the arithmetic progression proceed either clockwise or counterclockwise around the figure, even though the puzzle explicitly states this is not necessary. The added code surrounds the printing of the answer:
good = 0
IF total6 > total5 AND total5 > total4 AND total4 > total3 AND total3 > total2 THEN
good = 1
END IF
IF total6 < total5 AND total5 < total4 AND total4 < total3 AND total3 < total2 THEN
good = 1
END IF
IF good THEN
PRINT a; b; c; d; e; f; g; h; i; j; k; l
ct = ct + 1
END IF
(also added were the second of each of the pairs of lines:
total = b + c + d + e
total2 = total
total = h + i + j + k
total5 = total
total = b + f + i + l
total4 = total
total = h + f + c + a
total3 = total
total = l + j + g + e
total6 = total
)
This results in only 338 solutions, still barring rotations and reflections, so these are also unique.
The last one found, listed from A to L, is
8 12 11 3 5 6 1 4 2 10 9 7
which looks like
8
12 11 3 5
6 1
4 2 10 9
7
Again, 8+3+1+9 = 21, and the totals increase, in this case, clockwise.
The modification for a difference of 4 is merely:
tv(1) = 16: tv(2) = 20
tv(3) = 24: tv(4) = 28
tv(5) = 32: tv(6) = 36
as these comprise the necessary set of totals.
This results in 3216 unique solutions. Again asking for the successive arithmetic increments to be clockwise or counterclockwise in order, reduces the number of solutions to 94, the last of which is printed out as: 5 6 2 1 11 8 3 9 4 12 7 10, and in array is:
5
6 2 1 11
8 3
9 4 12 7
10
In this case, the successive sums proceed counterclockwise from the 5+1+3+7=16 side.
Further modification finds those cases where each side adds to 26. There are 72 such cases, made unique by requiring that H, A and K be in ascending order and that the 1 be in position H, C, G or I.
The last one found was 11 9 5 2 10 6 1 4 3 7 12 8:
11
9 5 2 10
6 1
4 3 7 12
8
|
Posted by Charlie
on 2008-06-01 23:56:16 |