Data update
This commit is contained in:
parent
72eb4943cb
commit
4d5544505c
2347 changed files with 62432 additions and 16731 deletions
24
Task/Magic-constant/GW-BASIC/magic-constant.basic
Normal file
24
Task/Magic-constant/GW-BASIC/magic-constant.basic
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
100 REM Magic constant
|
||||
110 PRINT "First 20 magic constants:";
|
||||
120 FOR N = 3 TO 20 + 3 - 1
|
||||
130 PRINT (N * N * N + N) / 2;
|
||||
140 NEXT N
|
||||
150 PRINT
|
||||
160 PRINT "1000th magic constant: ";
|
||||
170 N# = 1000! + 3 - 1
|
||||
180 MC1000# = INT((N# * N# * N# + N#) / 2)
|
||||
190 PRINT USING "#########"; MC1000#
|
||||
200 PRINT "Smallest order magic square with a constant greater than:"
|
||||
210 THRESH# = 10
|
||||
220 M# = 3
|
||||
230 FOR X = 1 TO 20
|
||||
240 MC# = (M# * M# * M# + M#) / 2
|
||||
250 M# = M# + 1
|
||||
260 IF MC# <= THRESH# THEN 240
|
||||
270 PRINT "10^";
|
||||
280 PRINT USING "##:"; X;
|
||||
290 PRINT USING "########"; M# - 1;
|
||||
300 THRESH# = THRESH# * 10
|
||||
310 IF X MOD 5 = O THEN PRINT ELSE PRINT "| ";
|
||||
320 NEXT X
|
||||
330 END
|
||||
Loading…
Add table
Add a link
Reference in a new issue