H FCOUNTFM CF E WORKSTN E N1 6 9 0 E S1 6 60 E N2 6 9 0 E S2 6 60 I 'NO ANSWER POSSIBLE' C CONST1 INQ1 DS 54 I 1 540N1 ISQ1 DS 360 I 1 360 S1 INQ2 DS 54 I 1 540N2 ISQ2 DS 360 I 1 360 S2 INQ DS 300 54 I 1 1 NQ3 ISQ DS 300 360 I 1 1 SQ3 C EXFMTREC1 C MOVEA*ZEROS N1 C MOVEA*ZEROS N2 C MOVEA*BLANKS S1 C MOVEA*BLANKS S2 C MOVELNUM1 S2,1 C MOVELNUM2 S2,2 C MOVELNUM3 S2,3 C MOVELNUM4 S2,4 C MOVELNUM5 S2,5 C MOVELNUM6 S2,6 C MOVE NUM1 N2,1 C MOVE NUM2 N2,2 C MOVE NUM3 N2,3 C MOVE NUM4 N2,4 C MOVE NUM5 N2,5 C MOVE NUM6 N2,6 C* CLEAR QUE ENTRYS C CLEARNQ C CLEARSQ C Z-ADD1 QENTS 40 * * SET UP INITIAL QUE ENTRIES * C EXSR SEND * MAIN LOOP C Z-ADD0 ANS D1 C DO *HIVAL C EXSR RECEV C 03 LEAVE * CHECK IF TARGET FOUND C N1,1 IFEQ TARGET C Z-ADD1 ANS 10 C ENDIF * IF FOUND., OR NO ANSWER C ANS IFNE 0 C C OREQ 0 C LEAVE C ENDIF * IF NOT FOUND, BUILD PERMUTATIONS C C IFGT 1 C C SUB 1 CC 10 D2 C 1 DO CC X C X ADD 1 XX 10 D3 C XX DO C Y 10 C MOVEA*BLANKS S2 C MOVEA*ZEROS N2 * * FILL IN OTHER NUMBERS C Z-ADD1 K D4 C 1 DO 6 KT 10 C KT IFNE X C KT ANDNEY C ADD 1 K C Z-ADDN1,KT N2,K C MOVE S1,KT S2,K C ENDIF ED4 C ENDDO * * ADD... C Z-ADD1 K 10 C N1,X ADD N1,Y N2,K C MOVE *BLANKS @STR 60 C CAT '(':0 @STR C CAT S1,X:0 @STR C CAT '+':0 @STR C CAT S1,Y:0 @STR C CAT ')':0 @STR C MOVE @STR S2,K * SEND TO DATA QUES C EXSR SEND * SUBTRACT NUMX - NUMY C Z-ADD1 K 10 C N1,X SUB N1,Y N2,K C MOVE *BLANKS @STR 60 C CAT '(':0 @STR C CAT S1,X:0 @STR C CAT '-':0 @STR C CAT S1,Y:0 @STR C CAT ')':0 @STR C MOVE @STR S2,K * SEND TO DATA QUES C EXSR SEND * SUBTRACT NUMY - NUMX C Z-ADD1 K 10 C N1,Y SUB N1,X N2,K C MOVE *BLANKS @STR 60 C CAT '(':0 @STR C CAT S1,Y:0 @STR C CAT '-':0 @STR C CAT S1,X:0 @STR C CAT ')':0 @STR C MOVE @STR S2,K * SEND TO DATA QUES C EXSR SEND * DONT MULTIPLY OR DEVIDE IF EITHER FACTOR IS 1 C N1,X IFNE 1 C N1,Y ANDNE1 * DEVIDE NUMX / NUMY C Z-ADD1 K 10 C N1,X DIV N1,Y N2,K C MVR @TMP 90 C MOVE *BLANKS @STR 60 C CAT '(':0 @STR C CAT S1,X:0 @STR C CAT '/':0 @STR C CAT S1,Y:0 @STR C CAT ')':0 @STR C MOVE @STR S2,K * SEND TO DATA QUES IF NO REMAINDER C @TMP IFEQ 0 C EXSR SEND C ENDIF * DEVIDE NUMY / NUMX C Z-ADD1 K 10 C N1,Y DIV N1,X N2,K C MVR @TMP 90 C MOVE *BLANKS @STR 60 C CAT '(':0 @STR C CAT S1,Y:0 @STR C CAT '/':0 @STR C CAT S1,X:0 @STR C CAT ')':0 @STR C MOVE @STR S2,K * SEND TO DATA QUES IF NO REMAINDER C @TMP IFEQ 0 C EXSR SEND C ENDIF * MULTIPLY.... C Z-ADD1 K 10 C N1,X MULT N1,Y N2,K C MOVE *BLANKS @STR 60 C CAT '(':0 @STR C CAT S1,X:0 @STR C CAT '*':0 @STR C CAT S1,Y:0 @STR C CAT ')':0 @STR C MOVE @STR S2,K C EXSR SEND * C ENDIF ** * OTHER PERMUTATIONS.. ED3 C ENDDO ED2 C ENDDO C ENDIF * C* ROUND THE LOOP AGAIN ED1 C ENDDO * C ANS IFNE 0 C MOVELS1,ANS SOL1 P C ELSE C MOVELCONST1 SOL1 P C ENDIF C END TAG C 03 SETON LR ** * RECEIVE FROM DATA QUES C RECEV BEGSR C* CALL 'QRCVDTAQ' C* PARM 'SQ' QNAM 10 C* PARM 'TONYLIB' QLIB 10 C* PARM 360 QLEN 50 C* PARM SQ1 C* PARM 0 QWAIT 50 C* CALL 'QRCVDTAQ' C* PARM 'NQ' QNAM 10 C* PARM 'TONYLIB' QLIB 10 C* PARM 54 QLEN 50 C* PARM NQ1 C* PARM 0 QWAIT 50 C SUB 1 QENTS C QENTS IFEQ 0 C Z-ADD0 C C ELSE C MOVE NQ NQ1 C MOVE SQ SQ1 C QENTS OCUR NQ C QENTS OCUR SQ C 1 DO 6 X 10 * C N1,X IFNE 0 C Z-ADDX C 10 C ENDIF * C ENDDO C ENDIF * C ENDSR * * SEND TO DATA QUES C SEND BEGSR C N2,1 IFGT 0 C N2,1 ANDLT2000 C ADD 1 QENTS C QENTS OCUR NQ C QENTS OCUR SQ C MOVE NQ2 NQ C MOVE SQ2 SQ C* CALL 'QSNDDTAQ' C* PARM 'SQ' QNAM 10 C* PARM 'TONYLIB' QLIB 10 C* PARM 360 QLEN 50 C* PARM SQ2 C* CALL 'QSNDDTAQ' C* PARM 'NQ' QNAM 10 C* PARM 'TONYLIB' QLIB 10 C* PARM 54 QLEN 50 C* PARM NQ2 C ENDIF C ENDSR