Data update
This commit is contained in:
parent
4d5544505c
commit
4924dd0264
3073 changed files with 55820 additions and 4408 deletions
25
Task/Arithmetic-derivative/Bc/arithmetic-derivative.bc
Normal file
25
Task/Arithmetic-derivative/Bc/arithmetic-derivative.bc
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
define d(n) {
|
||||
auto f
|
||||
if(n<0) return -d(-n)
|
||||
if(n<2) return 0
|
||||
s = 0
|
||||
r = n
|
||||
for(f=2;f<=r;f++) {
|
||||
while(r%f==0){
|
||||
r /= f
|
||||
s += n / f
|
||||
}
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
define padl(n,f) {
|
||||
for(i=0;i<f-(length(n)+(n<0));i++)
|
||||
print " "
|
||||
print n
|
||||
}
|
||||
|
||||
for(n=-99;n<101;n++) {
|
||||
q=padl(d(n),5)
|
||||
if((n+100)%10==0) print "\n"
|
||||
}
|
||||
20
Task/Arithmetic-derivative/Pluto/arithmetic-derivative.pluto
Normal file
20
Task/Arithmetic-derivative/Pluto/arithmetic-derivative.pluto
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
local int = require "int"
|
||||
local fmt = require "fmt"
|
||||
|
||||
local function D(n)
|
||||
if n < 0 then return -D(-n) end
|
||||
if n < 2 then return 0 end
|
||||
local f = int.factors(n)
|
||||
if #f == 1 then return 1 end
|
||||
if #f == 2 then return f[1] + f[2] end
|
||||
local d = n // f[1]
|
||||
return D(d) * f[1] + d
|
||||
end
|
||||
|
||||
local ad = {}
|
||||
for n = -99, 100 do ad[n + 100] = D(n) end
|
||||
fmt.tprint("%4d", ad, 10)
|
||||
print()
|
||||
for m = 1, 20 do
|
||||
fmt.print("D(10^%-2d) / 7 = %.0f", m, D(10 ^ m) // 7)
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue