Data update
This commit is contained in:
parent
8e4e15fa56
commit
72eb4943cb
1853 changed files with 35514 additions and 9441 deletions
44
Task/Arithmetic-derivative/CLU/arithmetic-derivative.clu
Normal file
44
Task/Arithmetic-derivative/CLU/arithmetic-derivative.clu
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
factors = iter (n: bigint) yields (bigint)
|
||||
own zero: bigint := bigint$i2bi(0)
|
||||
own two: bigint := bigint$i2bi(2)
|
||||
own three: bigint := bigint$i2bi(3)
|
||||
|
||||
while n>zero cand n//two = zero do yield(two) n := n/two end
|
||||
|
||||
fac: bigint := three
|
||||
while fac<=n do
|
||||
while n//fac = zero do yield(fac) n := n/fac end
|
||||
fac := fac + two
|
||||
end
|
||||
end factors
|
||||
|
||||
lagarias = proc (n: bigint) returns (bigint)
|
||||
own zero: bigint := bigint$i2bi(0)
|
||||
if n < zero then return(-lagarias(-n)) end
|
||||
|
||||
sum: bigint := zero
|
||||
for fac: bigint in factors(n) do
|
||||
sum := sum + n / fac
|
||||
end
|
||||
return(sum)
|
||||
end lagarias
|
||||
|
||||
start_up = proc ()
|
||||
own po: stream := stream$primary_output()
|
||||
own seven: bigint := bigint$i2bi(7)
|
||||
own ten: bigint := bigint$i2bi(10)
|
||||
|
||||
for n: int in int$from_to(-99, 100) do
|
||||
stream$putright(po, bigint$unparse(lagarias(bigint$i2bi(n))), 7)
|
||||
if (n + 100)//10 = 0 then stream$putl(po, "") end
|
||||
end
|
||||
|
||||
for m: int in int$from_to(1, 20) do
|
||||
d: bigint := lagarias(ten ** bigint$i2bi(m)) / seven
|
||||
stream$puts(po, "D(10^")
|
||||
stream$putright(po, int$unparse(m), 2)
|
||||
stream$puts(po, ") / 7 = ")
|
||||
stream$putright(po, bigint$unparse(d), 25)
|
||||
stream$putl(po, "")
|
||||
end
|
||||
end start_up
|
||||
Loading…
Add table
Add a link
Reference in a new issue