Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
27
Task/Magic-constant/XPL0/magic-constant.xpl0
Normal file
27
Task/Magic-constant/XPL0/magic-constant.xpl0
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
int N, X;
|
||||
real M, Thresh, MC;
|
||||
[Text(0, "First 20 magic constants:^M^J");
|
||||
for N:= 3 to 20+3-1 do
|
||||
[IntOut(0, (N*N*N+N)/2); ChOut(0, ^ )];
|
||||
CrLf(0);
|
||||
Text(0, "1000th magic constant: ");
|
||||
N:= 1000+3-1;
|
||||
IntOut(0, (N*N*N+N)/2);
|
||||
CrLf(0);
|
||||
Text(0, "Smallest order magic square with a constant greater than:^M^J");
|
||||
Thresh:= 10.;
|
||||
M:= 3.;
|
||||
Format(1, 0);
|
||||
for X:= 1 to 10 do
|
||||
[repeat MC:= (M*M*M+M)/2.;
|
||||
M:= M+1.;
|
||||
until MC > Thresh;
|
||||
Text(0, "10^^");
|
||||
if X < 10 then ChOut(0, ^0);
|
||||
IntOut(0, X);
|
||||
Text(0, ": ");
|
||||
RlOut(0, M-1.);
|
||||
CrLf(0);
|
||||
Thresh:= Thresh*10.;
|
||||
];
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue