Data update
This commit is contained in:
parent
ed705008a8
commit
0df55f9f24
2196 changed files with 32999 additions and 3075 deletions
28
Task/Arithmetic-derivative/XPL0/arithmetic-derivative.xpl0
Normal file
28
Task/Arithmetic-derivative/XPL0/arithmetic-derivative.xpl0
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
function integer Lagarias (N); \Lagarias arithmetic derivative
|
||||
integer N;
|
||||
integer F, Q;
|
||||
|
||||
function integer SmallPF (J, K); \Smallest prime factor
|
||||
integer J, K;
|
||||
return if rem(J/K) = 0 then K else SmallPF(J, K+1);
|
||||
|
||||
begin
|
||||
if N < 0
|
||||
then return -Lagarias (-N)
|
||||
else if N = 0 or N = 1
|
||||
then return 0
|
||||
else begin
|
||||
F := SmallPF (N, 2); Q := N / F;
|
||||
return if Q = 1
|
||||
then 1
|
||||
else Q * Lagarias (F) + F * Lagarias (Q)
|
||||
end;
|
||||
end \Lagarias\ ;
|
||||
|
||||
integer N;
|
||||
begin
|
||||
for N:= -99 to 100 do begin
|
||||
IntOut(0, Lagarias(N) );
|
||||
if rem(N/10) = 0 then CrLf(0) else ChOut(0, 9\tab\);
|
||||
end;
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue