# Posts Tagged ‘Square-bashing’

## Square-bashing by Arden

Posted by shirleycurran on 19 March 2010 There’s a scientific half to the ‘Stripey horse (5)’ team and, in desperation with Arden’s Square-bashing, I handed the pencil box over to him. Many stubs and heaps of paper later I joined him for the triumphal stages of squaring those numbers and finding that they locked neatly into each other, producing the LEFT/RIGHT that we had suspected from the start. Here’s his explanation in full, of how he went about this fearsome task. (Of course, you can skip the programmed bit!):

As usual I start by counting the occurences of the 20 letters in the clues. This gives T 32 times, I  23 times, S 19 times, R 16 times, E 13 times and so on. This makes it rather likely that T=1 and that I,S,R,E are ‘small’: 2,3,4,5….

The next step is to look at the 6  2-digit grid entries, 8a, 11a and 22d. Here there is a severe limit to the values of the entries (to be squared and have no leading zeros) to 4,5,6,7,8 or 9.Looks promising, but there are 7 letters involved (A,I,K,M,R,S and T). The most tightly fixed are I and T, appearing as TIT and T+I. The only possible values for T are immediately 1,2 and 3 (4 is too big when TIT is squared).

If T=3 then I=1 is the only option as TIT is at most 9. Also, if T=2, then I can only be 1 or 2 if TIT is at most 9: neither works for I+T (too small, and I cannot be 2 as well as T). If T=1 then the only possible values for I are 4,5,6,7 and 8. Can we say more?

Yes, looking at M/R.  As either T or I is 1, R cannot be 1 so is at least 2, so M is in the range 8-20. Also, R can be 2,3,4,5 only (R=6 cannot produced M/R at least 4).

What about MR/S? Not very helpful, but 20a is MR, 3 digits, 100-999 so 10 <= MR <= 31.6. As M is at least 8, R is now restricted to 2 or 3 only and thus MR is 16 at least, and this in turn restricts S (look at MR/S as 4-9) to range 4-20.

This is getting a bit complicated, as A and K are not yet considered. The former physicist resorts now to a programmed attack, as the possible combinations are not excessive. There are no longer 20x19x18x17x16x15x14 combinations, all entries must be integers and in range 4-9.

A 70 or so-line BASIC program running over the possible ranges of these 7 letters A-T checking these 6 entries to be the integers 4-9, each occurring just once, ran in a few minutes, checking 4.5 million combinations, producing just 2 options:

5 X%=0

6 Y%=0

10 FOR I%=4 TO 8

20 FOR A%=2  TO 20

30 IF A%=I% THEN GOTO 730

40 FOR K%=2  TO 20

50 IF K%=I% THEN GOTO 720

60 IF K%=A% THEN GOTO 720

70 FOR M%=2  TO 20

80 IF M%=I% THEN GOTO 710

90 IF M%=A% THEN GOTO 710

100 IF M%=K% THEN GOTO 710

110 FOR R%=2 TO 20

120 IF R%=I% THEN GOTO 700

130 IF R%=A% THEN GOTO 700

140 IF R%=K% THEN GOTO 700

150 IF R%=M% THEN GOTO 700

160 FOR S%=2 TO 20 STEP 2

170 IF S%=I% THEN GOTO 690

180 IF S%=A% THEN GOTO 690

190 IF S%=K% THEN GOTO 690

200 IF S%=M% THEN GOTO 690

210 IF S%=R% THEN GOTO 690

220 FOR T% = 1 TO 3 STEP 2

230 V1%=A%*S% \ K%

240 IF A%*S% MOD K% <> 0 THEN GOTO 680

250 IF ( V1% < 4 ) OR (V1% > 9 ) THEN GOTO 680

251 V1\$=STR\$(V1%)+” ”

255 VA\$=V1\$

260 V2%= M%*R% \ S%

270 IF M%*R% MOD S% <> 0 THEN GOTO 680

280 IF ( V2% < 4 ) OR (V2% > 9 ) THEN GOTO 680

282 V2\$=STR\$(V2%)+” ”

285 IF INSTR(VA\$,V2\$) > 0 THEN GOTO 680

286 VA\$=VA\$+V2\$

290 V3%=M%/R%

300 IF M% MOD R% <> 0 THEN GOTO 680

310 IF ( V3% < 4 ) OR (V3% > 9 ) THEN GOTO 680

312 V3\$=STR\$(V3%)+” ”

313 IF INSTR(VA\$,V3\$) > 0 THEN GOTO 680

314 VA\$=VA\$+V3\$

320 V4%=T%*T%*I%

330 IF ( V4% < 4 ) OR (V4% > 9 ) THEN GOTO 680

332 V4\$=STR\$(V4%)+” ”

333 IF INSTR(VA\$,V4\$) > 0 THEN GOTO 680

334 VA\$=VA\$+V4\$

340 V5%=A%*R%*T%  \ S%

350 IF ( V5% < 4 ) OR (V5% > 9 ) THEN GOTO 680

352 V5\$=STR\$(V5%)+” ”

353 IF INSTR(VA\$,V5\$) > 0 THEN GOTO 680

354 VA\$=VA\$+V5\$

360 IF A%*R%*T% MOD S% <> 0 THEN GOTO 680

370 V6%=I%+T%

380 PRINT STR\$(I%)+STR\$(A%)+STR\$(K%)+STR\$(M%)+STR\$(R%)+STR\$(S%)+STR\$(T%)

390 IF ( V6% < 4 ) OR (V6% > 9 ) THEN GOTO 680

392 V6\$=STR\$(V6%)+” ”

393 IF INSTR(VA\$,V6\$) > 0 THEN GOTO 680

394 VA\$=VA\$+V6\$

400 I\$=STR\$(I%)+” ”

410 ANS\$=I\$

420 A\$=STR\$(A%)+” ”

430 IF INSTR(ANS\$,A\$) > 0 THEN GOTO 680

440 ANS\$=ANS\$+A\$

450 K\$=STR\$(K%)+” ”

460 IF INSTR(ANS\$,K\$) > 0 THEN GOTO 680

470 ANS\$=ANS\$+K\$

480 M\$=STR\$(M%)+” ”

490 IF INSTR(ANS\$,M\$) > 0 THEN GOTO 680

500 ANS\$=ANS\$+M\$

510 R\$=STR\$(R%)+” ”

520 IF INSTR(ANS\$,R\$) > 0 THEN GOTO 680

530 ANS\$=ANS\$+R\$

540 S\$=STR\$(S%)+” ”

550 IF INSTR(ANS\$,S\$) > 0 THEN GOTO 680

560 ANS\$=ANS\$+S\$

570 T\$=STR\$(T%)+” ”

580 IF INSTR(ANS\$,T\$) > 0 THEN GOTO 680

590 ANS\$=ANS\$+T\$

600 PRINT “I A K M R S T possible answer “+ANS\$

610 PRINT “AS/K “+STR\$(V1%)

620 PRINT “MR/S “+STR\$(V2%)

630 PRINT “M/R  “+STR\$(V3%)

640 PRINT “TTI  “+STR\$(V4%)

650 PRINT “ART/S”+STR\$(V5%)

660 PRINT “I+T  “+STR\$(V6%)

670 INPUT “Go on?”,KYB\$

680 X%=X%+1

681 IF X% > 10000 THEN Y%=Y%+1

682 IF X% > 10000 THEN X%=0

685 NEXT T%

690 NEXT S%

700 NEXT R%

710 NEXT M%

720 NEXT K%

730 NEXT A%

740 NEXT I%

750 PRINT “Loop counts X Y “+STR\$(X%)+” “+STR\$(Y%)

A,I,K,M,R,S and T as 10,7,15,18,3,6,1 or  15,7,10,12,2,6,1

The first is disallowed by MR (20d) being 3 digits. So we have the first 7 letters! Cleverer chaps might do this with just brain and pencil, of course, but I can’t. Where next? The other 3-digit entry clues, 2d RET and 20d TUT, now limit E to 8,9,11,13,14 and U to 11,13,14,16,17,18,19,20.

It’s now a question of grinding on using the shortest entries (in digits) to restrict remaining values as much as possible, and then looking at possible intersections in the grids to fix values. It doesn’t take a lot of this, as for example a 4 digit grid entry 1000-9999 has only 68 clue values 32-99, and one ‘check intersection’ pins these quite tightly.

Simple, yes? Maybe it is for mathematicians and for Arden, but when I hear of four million possible combinations, I cringe and celebrate the fact that we now have three months before the next numerical one appears.