Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -1,55 +0,0 @@
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Numerics.Big_Numbers.Big_Integers; use Ada.Numerics.Big_Numbers.Big_Integers;
procedure Arithmetic_Derivative is
function D (N : Big_Integer) return Big_Integer is
Inc : Constant array (1 .. 8) of Big_Integer := (4, 2, 4, 2, 4, 6, 2, 6);
I : Integer := 1;
Num : Big_Integer := N;
P : Big_Integer := 2;
PCount : Big_Integer;
Result : Big_Integer := 0;
begin
if N < 0 then return -D(-N); end if;
if N = 0 or N = 1 then return 0; end if;
while P <= N / 2 loop
if Num mod P = 0 then
PCount := 0;
while Num mod P = 0 loop
Num := Num / P;
PCount := PCount + 1;
end loop;
Result := Result + (PCount * N) / P;
end if;
if Num = 1 then exit; end if;
if P >= 7 then
P := P + Inc(I);
I := (I mod 8) + 1;
end if;
if P = 3 or P = 5 then P := P + 2; end if;
if P = 2 then P := P + 1; end if;
end loop;
if Num > 1 then return 1; end if;
return result;
end D;
P : Big_Integer;
begin
for I in Integer range -99 .. 100 loop
P := To_Big_Integer(I);
Put(To_String(Arg => D(P), Width => 5));
if I mod 10 = 0 then New_Line; end if;
end loop;
for I in Integer range 1 .. 20 loop
P := 10 ** I;
Put("D(10^"); Put(Item => I, Width => 2); Put(") / 7 = ");
Put(Big_Integer'Image(D(P) / 7)); New_Line;
end loop;
end Arithmetic_Derivative;

View file

@ -1,31 +1,21 @@
library(gmp) #for big number factorization
arithmetic_derivative<-function(x){
if (x==0|x==1|x==-1){
D=0
arith_deriv <- function(x){
if(x %in% c(0, 1, -1)) return(0)
n <- abs(x)
facs <- as.numeric(factorize(n))
nfacs <- length(facs)
if(nfacs==1) return(sign(x))
d <- sum(facs[1:2])
if(nfacs>2){
c_prod <- cumprod(facs)
for(i in 3:nfacs) d <- d*facs[i]+c_prod[i-1]
}
else{
n=ifelse(x<0,-x,x)
prime_decomposition <-as.numeric(factorize(n))
if (length(prime_decomposition)==1){
D<- 1
}
else{
D<-sum(prime_decomposition[c(1,2)])
if (length(prime_decomposition)>2){
cumulative_prod <-cumprod(prime_decomposition)
for (i in 3:length(prime_decomposition)){
D<- D * prime_decomposition[i] + cumulative_prod[i-1]
}
}
}
}
sign(x)*D
sign(x)*d
}
print(t(matrix(sapply(-99:100,arithmetic_derivative),nrow=10)))
t(matrix(sapply(-99:100, arith_deriv), nrow=10))
for (k in 1:20){
x <- 10**k
cat(paste0("D(",x,")/7 = ",arithmetic_derivative(x)/7,"\n"),sep = "")}
pows <- 10^(1:20)
derivs <- sapply(pows, arith_deriv)
writeLines(paste0("D(", pows, ")/7 = ", derivs/7))