TtC2@Ta1@BüRESIZE 30,72€INIT 2000 100 1000€
üüüKimmo Vehkalahti (September 24, 2006):
Let us consider the following, open Survo puzzle given as Problem 11
in Seppo Mustonen's paper "On certain cross sum puzzles" (p. 24):Ta-1@TW10@Ta1@
LR1 A B C D
1 * * * * 51
2 * * * * 36
3 * * * * 32
4 * * * * 17
51 42 26 17
ü
It is not an easy puzzle, as its high measure of difficulty (MD=2050)
suggests. However, it can be solved, presumably by a few alternative
strategies. In the following, I will describe my own solution (June,
2006) using various means of Survo. Originally I also used paper and
pen in some stages, which I will mention as we proceed.
Ta-1@TW100@Ta1@
At first glance, the numbers 17 and 51 seem temptating, as they appear
among both the row and the column sums. Indeed, they are the key points
to begin the solution. The other rows and columns have simply too many
partitions, which is easily detected:
Ta-1@TW30@Ta1@LoLO
LR2COMB P,END+2 / P=PARTITIONS,36,4 DISTINCT=1 MAX=16 RESULTS=0
COMB P,END+1 / P=PARTITIONS,32,4
COMB P,END+1 / P=PARTITIONS,42,4
COMB P,END+1 / P=PARTITIONS,26,4
Lr2€Ta-1@TW20@
º¹¹¹Probably, it would be quite hard to
ºbegin from any of these!TW30@Ta1@üTgCEND+1@CEND+1@C1@.±
The partitions of 51 and 17 turn out to be more useful:
ü
COMB P,CUR+3 / P=PARTITIONS,17,4 DISTINCT=1 MAX=16€
COMB P,END+2 / P=PARTITIONS,51,4Ta-1@TW30@Ta1@€
Ta-1@TW20@Ta1@üi1L3i2L4Tg1@CEND+2@C1@The double role of both 17 and 51 imply that in both we must find
µµµµµsuch pairs of partitions
º that have µµµµµexactly one common numberµµµ.
Ta-1@TW100@Ta1@üLo¹¹¹TgCEND+1@CEND+2@C1@LOüI begin by marking such possible pairs in both lists with '*':
Ta-1@TW30@Ta1@
¹Ta-1@ü********************************
TW20@1234567890123456 (for counting) - then, similarly for 51:
TW20@
**********Ta1@**********************
üTa-1@TW50@Ta1@There are 16 possible pairs of partitions in both lists. Their common
numbers are the µµµµµcandidates for the corner elementsµµµ D4 and A1:S??//S
Ta-1@TW20@Ta1@ü
COPY 6,11,CUR€
C*S/S
C*C*C*C*S?S
üTa-1@TW50@Ta1@Now, it would be profitable to get parallel lists of the pairs
in order to proceed further. The lists would begin like this:
Ta-1@TW20@Ta1@üTa-1@
´VVVV=
CLEAR CUR+1,END€
º °°
... (etc.)
TW30@üTa1@
However, it is not very wise (or funny) to do this manually,
so let us create a small µµµµµµsucroµµ (Survo macro) for the task!
Ta-1@TW30@Ta1@
LoLOüLR2TUTSAVE P11 / The sucro will simply do the above 'dirty work' for us.
+A: {r}{save char W1}{ref set 1}
-if W1 '=' {sp} then goto E
+ 1: {d}{save char W1}
-if W1 '=' {sp} then goto 1
{ref set 2}
{line start}{block}{block}{r11}{block}
{jump END-1,END+1,1}{block}{del}
{ref jump 2}
+2: {d}{save char W1}
-if W1 '=' {sp} then goto 2
{line start}{block}{block}{r11}{block}
{jump END-1,END,1}{r13}{block}{del}
{ref jump 1}{goto A}
+E: {end}
Lr2€üi1L3i2L4Tg1@CEND+2@C1@Ta-1@TW70@Ta1@üThe setup for running the sucro P11 will be as follows:BLoü¹¹¹
¹Ta-1@TW20@Ta1@LO/P11S_S----------------S/S
The dotted line helps the sucro to
navigate in the edit field.
B±CUR-13
The same sucro will be employed twice.
Ta-1@We begin from the 'red square',
and in the end, the cursor will
be located in the blue square.
LR2üi1L3i2L4Tg1@CEND+2@C1@
The new, parallel list will appear below...
............................................TW30@Lr2BüTa1@Lo€LOLoTtC1@Ta-1@üTa1@€LOüTa-1@TW30@Ta1@³The new
For easier reference, I will indicate the corner elements in the list
with the same colors as above:LR2
Ta-1@TW30@Ta1@;\U\S\S
-??
??
??
??
??
??
??
??
??
??
??
??
??
??
??
??
////
////
////
////
////
////
////
////
////
////
////
////
////
////
////
////#
üTtC1@Ta-1@TW20@Ta1@Lr2LoBLOüTa-1@Sometimes it may be fun to simply print this kind of list, and operate
with paper and pen for a while. Actually, I did this while working
with the problem initially, as it would have been impractical to eat
lunch with the computer...TW30@
Ta1@PRINT CUR+2,CUR+38 TO K.PS / prints the page in PostScript format
/GS-PDF K.PS / opens the page in PDF format by Adobe Reader
--- [Courier(11)][line_spacing(16)][margin(300)]
shadow ?: [BOLD][REVERSE] [NORMAL]
shadow /: [BOLD][DOTTED] [NORMAL]
Ta-1@TW50@Ta1@üTgCEND+1@CEND+2@C1@üLet's look at the table again:LR2Lo³candidates for
¹¹¹Lr2
¹SoSS5Si1L3i2L4Tg1@CEND+2@C1@LOTa-1@TW20@Ta1@üNow we have the common numbers for the partitions of 17 and 51, but
the next goal is to find µtheirµµµµµµµ common numbers, i.e., the candidates
for the corner elements A4 and D1Soo 55S¹¹¹¹º.Despite of their different colors
we must be aware of the symmetricity: ¹¹¹¹ºcould be exchanged
to ¹¹¹¹S55 ooS as well! We will return to this later.
Ta-1@TW100@Ta1@
Again it is required for a pair that it only has one common number
µµµbetweenµµµµµ the partitions of 17 and 51. Now we do µnotµµµµµµµ pay attention to
the common numbers µµµwithinµµµµµ those partitions (the corner elements).
Apparently, the pairs can be found exactly the same way as before:
LR2üTa-1@TW70@Ta1@Lo¹¹¹Lr2¹LOTa-1@TW20@Ta1@TgCCUR-2@CCUR@C1@LR2Ta-1@ü*****************Ta1@***********üTtC1@Ta-1@TW30@Ta1@LoLr212345678901234
/P11µµµµµBµµµLR3S_S--------------
LOTa-1@TW30@Ta1@TgCEND+1@CEND+2@C1@üThere are still 14 possible combinations. We can recycle the sucro
P11 created above to take us immediately one step further. The code
works as such, we just have to make a minor update, as the lists are
a bit broader. Let us copy the code here and make the changes:
Ta-1@TW50@Ta1@üLo
LR2³TUTSAVE
¹¹¹
Lr2LOTa-1@¹µµµµµBµµµ / (It could be given the same name as well.)³r11
µµµµµr25µµµ³µ
µµµµµr25µµµ³r13
µµµµµr25
Ta1@
Ta-1@TW30@Ta1@This time the sucro is needed only once, and it produces the following:
.......................................................................
Ta-1@TW30@Ta1@Lo³TUTSAVE
€Lr3€üTgCEND-15@CEND+2@C1@LOTa-1@TW50@Ta1@üLR3For easier reference, I again paint the common numbers with SoS and S5S
(remembering that they could also be the other way around).
Ta-1@TW10@Ta1@ü;\U\S\S
-oo55oo
oo55oo
oo55oo
oo55oo
oo55oo
oo55oo
oo55oo
oo55oo
o55o
o55o
o55o
o5o5
o5o5
o55o#
üTtC1@Ta-1@TW30@Ta1@It seems logical to change the order in the second last and third
last partitions of 51.
Ta-1@TW20@Ta1@üLR2Ta-1@ ¹¹¹¹Ta1@Lr2Ta-1@TW30@Ta1@üLr3SCRATCHTa-1@TW10@Ta1@€Ta-1@TW10@Ta1@üNow, these are the 14 possible sets for the 'edge' of the table.
Let us denote the elements of the edge by a,b,c,d and x,y,z,w:
Ta-1@TW20@Ta1@LR2Loü³Let's look
¹¹¹Lr2
¹LR2üLOabcdxywzLr2Ta-1@TW20@Ta1@ü¹¹¹SHADOW BLOCK 7€
Ta-1@TW20@Ta1@üWhat remains is the µµµµµµµinner blockµ of four numbers. To find them, we must
work with the edges. As the corners A4 and D1Soo 55S are not uniquely
determined, we still have quite many possibilities.Ta-1@TW100@Ta1@üLo
We will need the 14 sets for excluding the elements of the edge.
For that, we edit them in the form of specifications as follows:
LR2¹¹º¹Lr2¹üTgCCUR-4@CCUR@C1@LOTa-1@TW30@Ta1@LINES=CUR+1,CUR+14
REPLACE " "," ",C€€€REPLACE " ",",",C€REPLACE,",,","",C€REPLACE,", ","",C€
Ta-1@TW20@Ta1@üINSERT 9Ta-1@TW10@Ta1@€ *OFF___=
SET CUR+1,CUR+14,CUR-1Ta-1@TW10@Ta1@€ 111
COUNT º 101Ta-1@TW5@Ta1@€
DELETETa-1@TW5@Ta1@€üTa-1@TW20@Ta1@Each of these 14 sets includes 12 distinct numbers (the edge).
Ta-1@TW50@Ta1@üThe goal is now to find out, which one of these sets consists of such
numbers that, together with the remaining 4 numbers (the inner block),
the sums of the rows and columns are determined uniquely.
Ta-1@TW50@Ta1@In other words, as all the 14 sets are possible choices for the edge,
we must look for a particular set where the remaining 4 numbers
(µµµµµµµB2µ,µµµµµµµC2µ,µµµµµµµB3µ,µµµµµµµC3µ) give a unique solution to the following equations:
Ta-1@TW10@Ta1@
a+B3+B2+x=42
b+C3+C2+y=26
c+C2+B2+z=36
d+C3+B3+w=32
Ta-1@TW70@Ta1@º
Ta-1@Note that the corner elements are
not needed here, since they will be
implied by the rest of the elements.TW30@
µµµµµBut, it is not that simple...
TW30@Ta1@B
üTtC1@Ta-1@TW20@Ta1@LoLOüTa-1@TW20@Ta1@We have to remember that even the edge is not completely determined,
that is, its rows and columns may be interchanged (row 4 and column D
both sum to 17, and similarly row 1 and column A sum to 51).
Hence we must check all the relevant combinations of the sums with each
of the 14 sets. So we pick up the non-corner elements from the 14 lists
(by removing the colorful corner elements) and use them as values for
the symbols a,b,c,d and x,y,z,w for each set:
Ta-1@TW50@Ta1@
¹¹¹¹Ta-1@TW20@Ta1@LINES=CUR+1,CUR+14
üATtC1@üREPLACE "1"S?S,"",CTa-1@TW20@Ta1@€REPLACE "2"S?S,"",CTa-1@TW20@Ta1@€REPLACE "3"S?S,"",CTa-1@TW10@Ta1@€REPLACE "6"S5S,"",CTa-1@TW10@Ta1@€REPLACE "7"S5S,"",CTa-1@TW5@Ta1@€REPLACE "8"S5S,"",CTa-1@TW5@Ta1@€REPLACE "9"S5S,"",CTa-1@TW5@Ta1@€REPLACE "8"SoS,"",CTa-1@TW5@Ta1@€REPLACE "9"SoS,"",C€REPLACE "10"SooS,"",C€REPLACE "11"SooS,"",C€REPLACE "14"S//S,"",C€REPLACE "15"S//S,"",C€REPLACE "16"S//S,"",C€üTa-1@TW20@Ta1@111
INSERT 5Ta-1@TW10@Ta1@€COUNT CUR+1,CUR+14,CUR-1,101Ta-1@TW5@Ta1@€
DELETETa-1@TW5@Ta1@€Ta-1@TW20@Ta1@üTgCEND-2@CCUR@C1@TXaw@Ta-1@
i3wTIA3@C @@GEaw@@Wa=Wb=Ta1@Wc=Wd=Wx=Wy=Wz=Ww=TLGaw@TXEaw@
TtC1@Ta-1@TW20@Ta1@TgCEND-8@CCUR@C1@There might be a shorter way to find the solution, but I wanted to
take the complete route and check all the combinations systematically.
Ta-1@TW30@Ta1@I also wanted to demonstrate some of the possibilities of solving
Survo puzzles by using a few Survo operations especially related to
data and matrix computations. (Some of those tools may not be
available in the freeware version µµµµµSurvo Editorµµµ).
Ta-1@TW70@Ta1@
TgCEND+1@CCUR@C1@For clarity, I will go through the first alternative step by step.
I recall that we are now focusing on the following equations:
a+B3+B2+x=42
b+C3+C2+y=26
c+C2+B2+z=36
d+C3+B3+w=32
Ta-1@TW50@Ta1@First, we will need a list of expressions involving those four sums
by different combinations of a,b,c,d and x,y,z,w. In other words:
µµµµµwhat are the possible numbers for the remaining sums in each case?
Ta-1@TW30@Ta1@
A: 42-(a+x).=
26-(b+y).=
36-(c+z).=
32-(d+w).=
B: 42-(a+x).=
26-(b+y).=
36-(d+w).=
32-(c+z).=
C: 42-(b+y).=
26-(a+x).=
36-(c+z).=
32-(d+w).=
D: 42-(b+y).=
26-(a+x).=
36-(d+w).=
32-(c+z).=
ºLR3
Ta-1@TW70@Ta1@üTgCEND-8@CCUR@C1@
Although we will work intensively with the 16 single expressions, we
will focus especially on the µµµµµgroups of 4 expressionsµµµ.
To check each single alternative, we need to employ COMB a few times.
Ta-1@TW50@Ta1@
B
üCOMB P01? END+1 / P01? =PARTITIONS,
SET B+1,B+16,CUR-1Ta-1@TW20@Ta1@€Ta-1@TW20@Ta1@LoLR2TgCEND-10@CEND+2@C1@.±
LR4üLr2LOCOUNT B+1,B+16,CUR+1,1,1,4
1Ta-1@TW20@Ta1@€
1Ta-1@TW20@Ta1@€
REPLACE "1 END+1","1 END+2",C / LINES=B+1,B+16Ta-1@TW20@Ta1@€üREPLACE "?","A",C / LINES=B+01,B+04Ta-1@TW10@Ta1@€REPLACE "?","B",C / LINES=B+05,B+08Ta-1@TW5@Ta1@€REPLACE "?","C",C / LINES=B+09,B+12€REPLACE "?","D",C / LINES=B+13,B+16€Ta-1@TW10@Ta1@üDISTINCT=1 RESULTS=0 OFF=*OFFTa-1@TW10@01TW10@Ta1@
LR2Let's activate the above expressions using the first non-corner set.Ta-1@TW20@Ta1@Lr3Ta-1@TW10@Ta1@€Ta-1@TW10@Ta1@Lo¹¹¹LOTa-1@TW10@Ta1@Lr2
ºTa-1@TW10@Ta1@¹üBTa-1@TW20@Ta1@PUTEND B+1,B+16,#2Ta-1@TW20@Ta1@€REPLACE "#" "," CTa-1@TW20@Ta1@€
üTa-1@TW30@Ta1@€üLr4TtC1@Ta-1@TW10@Ta1@LoLOüBelow, there are the short results of the 16 COMB operations.
Next, we transform them into the form of a Survo data file:
Ta-1@TW30@Ta1@
üERASE CUR+1 END N[]= Ta-1@TW20@€TW10@Ta1@SAVEP CUR+1 END+1 P.TXTTa-1@TW10@€TW10@Ta1@SCRATCHTa-1@TW10@Ta1@€üFILE SAVE P.TXT TO NEW P / SKIP_ERRORS=2Ta-1@TW10@Ta1@€
VAR X6=if(X6=MISSING)then(0)else(X6) TO PTa-1@TW5@Ta1@€
VAR X1=MISSING TO PTa-1@TW5@Ta1@€
..........
VAR str(X5)=str(X5[-1],1,4) TO P / CASES=X5,MISSINGTa-1@TW5@Ta1@€
..........
VAR str(X1)=str(X5,4,2) TO PTa-1@TW5@Ta1@€
..........
MAT SAVE DATA P TO P / VARS=X1,X6Ta-1@TW5@Ta1@€
MAT P(0,1)="P01"Ta-1@TW5@Ta1@€
MAT P=P'Ta-1@TW5@Ta1@€
FILE DEL PP€FILE SAVE MAT P TO PP / TYPE=1Ta-1@TW5@Ta1@€
Ta-1@TW70@Ta1@TgCEND+1@CEND+2@C1@üThe data file PP consists of one record only. It includes the numbers
of the partitions for each single alternative for the first non-corner
set 01. Those 16 numbers are arranged in consecutive groups of 4, and
between each group there is a variable whose value is zero. I display
the beginning of the record (the groups a and b):
Ta-1@TW30@Ta1@..........
FILE LOAD PP CUR+2 / MASK=LAAAAABBBBBTa-1@TW10@Ta1@€
Ta-1@TW20@Ta1@üµµµµµ
Ta-1@TW30@Ta1@üThe groups of 4 seen here are now highlighted. We can see that in the
first one (A), there are 3 possible solutions for the first equation,
that is, a+B3+B2+x=42 but no solutions for the 3 other equations.
Similarly in B, there are solutions to some of the equations. What we
are looking for is µµµµµa group that has exactly 1 solution for each oneµµµ,
i.e., a sequence µµµµµ1111µµµ.
Ta-1@TW50@Ta1@
We are going to find that group by using a systematic search over all
possibilities, but first we must repeat the above steps for the rest
of the 14 CASEs, the sets of the elements of the edge.Ta-1@TW50@Ta1@µµµµµLet's do it!!µµµTa-1@TW70@Ta1@üT!3@C1@TXTheRest@T=3@3@+@C1@T!1@3@TIN3@C14@@@GEndRest@TIN3@C10@@Gii@Gii@T=1@C0@&@3@TXii@T=2@3@-@C1@üLr4SCRATCH€Lr2üREPLACE "="," ",C / LINES=A+@2€³OFF
OFF=*OFF=
TgCEND-10@CEND+1@C1@COPY CUR-16,CUR-1,CUR+1€REPLACE ´W=
P= C€CLEAR CUR+1,END€üLoLR5TgCEND-10@CEND+2@C1@.±
LR4üLr3€¹¹¹Lr5LO
º¹üPUTEND CUR+1,CUR+16,#2€REPLACE "#" "," C€
ü€üLr4üERASE CUR+1 END N[]= €SAVEP CUR+1 END+1 P.TXT€SCRATCH€üFILE SAVE P.TXT TO NEW P / SKIP_ERRORS=2€
VAR X6=if(X6=MISSING)then(0)else(X6) TO P€
VAR X1=MISSING TO P€
..........
VAR str(X5)=str(X5[-1],1,4) TO P / CASES=X5,MISSING€
..........
VAR str(X1)=str(X5,4,2) TO P€
..........
MAT SAVE DATA P TO P / VARS=X1,X6€
MAT P(0,1)="P="€
MAT P=P'€
FILE SAVE MAT P TO PP / TYPE=1€
üTLGTheRest@TXEndRest@.±
TgCEND+1@CEND+2@C1@üüNow we have all the 16*14=€º sequences of four numbers,
that is, the possible solutions to the four equations we are studying.
We are interested in the Sequence=1,1,1,1 which can be found most
conveniently by the following command:
Ta-1@TW50@Ta1@
VARSTAT PP,Match:1,FIRST,SequenceTa-1@TW30@Ta1@€
..........
If the sequence is µnotµµµµµµµ found, the value of Match is missing. Otherwise
Match includes the number of the variable where the sequence starts.
Ta-1@TW30@Ta1@Let us see what we got:
FILE LOAD -PP CUR+2 / CASES=Match,!MISSING VARS=CASE,Match€
üWi3wWi1w
Ta-1@TW20@Ta1@We can see that the elements of the edge will be given by the set @3º.
The sequence of the inner elements starts at variable #=º...
Ta-1@TW10@Ta1@üFILE STATUS PP / VARS=#=€
WWWWi2wTa-1@TW20@Ta1@...which seems to point at the set D (D1,D2,D3,D4).Ta-1@TW70@Ta1@
..........
üTgCEND+1@CEND+2@C1@Let us fetch all the information we have about those elements...
Ta-1@TW30@Ta1@üLR2Lo³ *OFF10
¹¹º¹Lr2LO¹
üTa-1@TW20@Ta1@COPY A+10,A+10 CUR+1Ta-1@TW20@€TW20@Ta1@
üLR2Lo³Let us denote
¹¹¹Lr2LO¹Ta-1@TW30@Ta1@üLR2Lo³D:
¹¹¹Lr2LO
¹Ta-1@TW30@Ta1@ü...and then put everything in their correct places:
Ta-1@TW50@Ta1@üTa-1@15s//ss8ss2ss9sTW50@baxywzcd
TW50@
513412161413
TW50@ü
Finally, the inner elements are found by those four COMBs, which
were labeled "P10Di",TW5@ i=1,2,3,4,TW5@ using DISTINCT=1 and OFF=*OFF10
specifications,TW5@ now with full RESULTS:
Ta1@LR2Lo³COMB P10D1
¹¹º¹Lr2LO¹Ta-1@TW30@€TW30@µµµµµWe have the solution!µµµLR2TW30@µµµµµµµ10TW20@11TW20@6TW20@7
TW20@Lr2üi1L3i2L4Tg1@CEND+1@C1@µTTW3@hTW3@eTW6@ TW3@ETW3@nTW3@dµµµµµµµTÿ
def Wr=W1 Wc=W2 Wx=W3
{tempo +1}{20}{tempo -1}
{tempo +1}{10}{tempo -1}
{30}
{30}
3: lausekkeiden aktivointipaikka
4: tulosten alkupaikka
Wc: the previous, Wx: the current, Wr: Wx with leading zero!
4: tulosten alkupaikka
{tempo +1}{30}{tempo -1}
Wx: P10 Wr: 17 Wc: D1