老人分马
5 REM '分马'
10 PRINT "N", "X", "Y", "Z"
20 FOR N = 6 TO 41
30 FOR X = 3 TO (N + 1) / 2
40 FOR Y = 2 TO X - 1
50 Z = N - X - Y: IF Z >= Y THEN 100
60 IF INT((N + 1) / X) <> (N + 1) / X THEN 100
70 IF INT((N + 1) / Y) <> (N + 1) / Y THEN 100
80 IF INT((N + 1) / Z) <> (N + 1) / Z THEN 100
90 PRINT N, X, Y, Z
100 NEXT Y, X, N
110 END
以上程序用Basic语言编写,在PC-286(无硬盘)机上,调试通过。