Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,27 @@
MODULE BabbageProblem;
FROM FormatString IMPORT FormatString;
FROM RealMath IMPORT sqrt;
FROM Terminal IMPORT WriteString,ReadChar;
VAR
buf : ARRAY[0..63] OF CHAR;
k : INTEGER;
BEGIN
(* Find the greatest integer less than the square root *)
k := TRUNC(sqrt(269696.0));
(* Odd numbers cannot be solutions, so decrement *)
IF k MOD 2 = 1 THEN
DEC(k);
END;
(* Find a number that meets the criteria *)
WHILE (k*k) MOD 1000000 # 269696 DO
INC(k,2)
END;
FormatString("%i * %i = %i", buf, k, k, k*k);
WriteString(buf);
ReadChar
END BabbageProblem.