Language: QuickBasic 64 (which can be downloaded for free at www.QB64.net). Notes about the program: Lines 700 to 760 move the program right to the known solutions, and then the program goes to a point of current searching. If these lines are removed, the program searches linearly from the beginning and tries every possible radius (an integer) starting with R# = 1. This program will find all of the known solutions in about 171 days. The next solution may not show up for about a thousand years according to my computations. The program is designed to provide data for valid answers printed in red. The data includes radius, ratio of uncut square tiles internal to the circle to the cut square tiles, number of uncut square tiles internal to the circle, number of cut square tiles, number of uncut tiles external to the circle but contained in a circumscribed square, and total number of tiles within the circumscribed square. As the program runs, hitting the "D" or "d" keys will cause the program to print out data in yellow for the current R# (radius). This shows the fractional ratio of a non-answer R#. Hitting the space bar causes the program to simply print out the current R# in green. Hitting "S" or "s" stops the program. The oddest lines in the program occur at lines 612 and 614. The program starts looking at the top row of tiles in the circle and continues moving down until reaching the diagonal line running from the center of the circle to the "northeast". With proper computing, the program counts square tiles in 1/8th of the circle thereby. But for every radius, 8 half-tiles get counted twice, so a 4 is subtracted in line 612. For some circles an additional 8 squares get counted twice and must be subtracted at line 614. By way of examples, only 4 squares must be subtracted if the radius of the circle is one of the following integers: 1, 2, 3, 4, 5, 6, 9, or 10. But an additional 8 squares must be subtracted when the radius is one of the following integers: 7, 8, 11, or 12. Inspection of drawings of these circles on graph paper will reveal the different geometries involved. 50 REM Circle Tiling with Square Tiles and Integer Ratios of Uncut to Cut Tiles REM Inspired by New Scientist Magazine, Enigma #1686 SCREEN _NEWIMAGE(1024, 768, 256) R# = 1: NR# = R#: CLS: PRINT: COLOR 1 120 ISQ# = 0: BSQ# = 0: OSQ# = 0: TE# = R#: ' Set Top Edge 200 LE# = INT(SQR(R# ^ 2 - TE# ^ 2)): ' Set Left Edge BE# = TE# - 1: ' Set Bottom Edge TST# = R# ^ 2 - BE# ^ 2 RE# = SQR(TST#) 312 REINT# = INT(RE#): ' Set Right Edge Integer IF RE# = REINT# THEN REF# = RE#: GOTO 350 REF# = REINT# + 1: ' Set Right Edge Final 350 ISQ# = ISQ# + LE#: BSQ# = BSQ# + REF# - LE#: ' Tally up the squares OSQ# = OSQ# + R# - REF# 370 P# = INT(SQR(R# ^ 2 / 2)) 400 IF BE# = P# THEN GOTO 600 NR# = NR# - 1: TE# = BE#: GOTO 200: ' Decrement NR 600 ISQ# = 4 * (2 * ISQ# + BE# ^ 2) 610 IF ISQ# > 9999999999999999 THEN 1200 612 BSQ# = 8 * BSQ# - 4 614 A# = INT(SQR(R# ^ 2 / 2)): IF R# ^ 2 > 2 * A# ^ 2 + 2 * A# + 1 THEN BSQ# = BSQ# - 8 OSQ# = 4 * R# ^ 2 - ISQ# - BSQ# a$ = INKEY$ IF a$ = "S" THEN END IF a$ = "s" THEN END IF a$ = "D" THEN GOSUB 1100 IF a$ = "d" THEN GOSUB 1100 IF a$ = "q" THEN PRINT IF a$ = "Q" THEN PRINT IF a$ = " " THEN PRINT R#; : PRINT " "; Q# = ISQ# / BSQ#: IF Q# - INT(Q#) > 0 THEN GOTO 1000 PRINT: COLOR 12: PRINT R#; : PRINT " "; : PRINT Q#; : PRINT " "; : PRINT ISQ#; : PRINT " "; PRINT BSQ#; : PRINT " "; : PRINT OSQ#; : PRINT " "; : PRINT ISQ# + BSQ# + OSQ#: COLOR 10 700 IF R# = 15 THEN R# = 363 710 IF R# = 364 THEN R# = 584 720 IF R# = 585 THEN R# = 5051 730 IF R# = 5052 THEN R# = 9572 740 IF R# = 9573 THEN R# = 191713 750 IF R# = 191714 THEN R# = 13682427 760 IF R# = 13682428 THEN R# = 13695840 1000 R# = R# + 1: GOTO 120 1100 COLOR 14: PRINT R#; : PRINT " "; : PRINT Q#; : PRINT " "; : PRINT ISQ#; : PRINT " "; PRINT BSQ#; : PRINT " "; : PRINT OSQ#; : PRINT " "; : PRINT ISQ# + BSQ# + OSQ# COLOR 10: RETURN 1200 COLOR 14: PRINT: PRINT "NUMBERS HAVE GOTTEN TOO LARGE. THE PROGRAM HAS ENDED.": PRINT: PRINT: END