Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
31
Task/Arithmetic-numbers/XPL0/arithmetic-numbers.xpl0
Normal file
31
Task/Arithmetic-numbers/XPL0/arithmetic-numbers.xpl0
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
int N, ArithCnt, CompCnt, Div, DivCnt, Sum, Quot;
|
||||
[Format(4, 0);
|
||||
N:= 1; ArithCnt:= 0; CompCnt:= 0;
|
||||
repeat Div:= 1; DivCnt:= 0; Sum:= 0;
|
||||
loop [Quot:= N/Div;
|
||||
if Quot < Div then quit;
|
||||
if Quot = Div and rem(0) = 0 then \N is a square
|
||||
[Sum:= Sum+Quot; DivCnt:= DivCnt+1; quit];
|
||||
if rem(0) = 0 then
|
||||
[Sum:= Sum + Div + Quot;
|
||||
DivCnt:= DivCnt+2;
|
||||
];
|
||||
Div:= Div+1;
|
||||
];
|
||||
if rem(Sum/DivCnt) = 0 then \N is arithmetic
|
||||
[ArithCnt:= ArithCnt+1;
|
||||
if ArithCnt <= 100 then
|
||||
[RlOut(0, float(N));
|
||||
if rem(ArithCnt/20) = 0 then CrLf(0);
|
||||
];
|
||||
if DivCnt > 2 then CompCnt:= CompCnt+1;
|
||||
case ArithCnt of 1000, 10_000, 100_000, 1_000_000:
|
||||
[CrLf(0);
|
||||
IntOut(0, N); ChOut(0, 9\tab\);
|
||||
IntOut(0, CompCnt);
|
||||
]
|
||||
other;
|
||||
];
|
||||
N:= N+1;
|
||||
until ArithCnt >= 1_000_000;
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue