If two 1's, two 2's and two 3's are arranged thus:
2 3 1 2 1 3
then the two 1's enclose 1 other digit, the two 2's enclose 2 other digits, and the two 3's enclose 3 other digits.
Can you
find a similar arrangement using the seven pairs 1,1,...7,7?
DIM taken(14)
OPEN "231213.txt" FOR OUTPUT AS #2
FOR a1 = 1 TO 12
b1 = a1 + 2
taken(a1) = 1: taken(b1) = 1
FOR a2 = 1 TO 11
b2 = a2 + 3
IF taken(a2) = 0 AND taken(b2) = 0 THEN
taken(a2) = 2: taken(b2) = 2
FOR a3 = 1 TO 10
b3 = a3 + 4
IF taken(a3) = 0 AND taken(b3) = 0 THEN
taken(a3) = 3: taken(b3) = 3
FOR a4 = 1 TO 9
b4 = a4 + 5
IF taken(a4) = 0 AND taken(b4) = 0 THEN
taken(a4) = 4: taken(b4) = 4
FOR a5 = 1 TO 8
b5 = a5 + 6
IF taken(a5) = 0 AND taken(b5) = 0 THEN
taken(a5) = 5: taken(b5) = 5
FOR a6 = 1 TO 7
b6 = a6 + 7
IF taken(a6) = 0 AND taken(b6) = 0 THEN
taken(a6) = 6: taken(b6) = 6
FOR a7 = 1 TO 6
b7 = a7 + 8
IF taken(a7) = 0 AND taken(b7) = 0 THEN
taken(a7) = 7: taken(b7) = 7
FOR i = 1 TO 14
PRINT (STR$(taken(i)));
PRINT #2, (STR$(taken(i)));
NEXT
PRINT
PRINT #2,
ct = ct + 1
taken(a7) = 0: taken(b7) = 0
END IF
NEXT
taken(a6) = 0: taken(b6) = 0
END IF
NEXT
taken(a5) = 0: taken(b5) = 0
END IF
NEXT
taken(a4) = 0: taken(b4) = 0
END IF
NEXT
taken(a3) = 0: taken(b3) = 0
END IF
NEXT
taken(a2) = 0: taken(b2) = 0
END IF
NEXT
taken(a1) = 0: taken(b1) = 0
NEXT
PRINT ct
finds the following 30 solutions:
1 7 1 2 5 6 2 3 4 7 5 3 6 4
1 7 1 2 6 4 2 5 3 7 4 6 3 5
1 6 1 7 2 4 5 2 6 3 4 7 5 3
1 5 1 6 7 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