Data update
This commit is contained in:
parent
72eb4943cb
commit
4d5544505c
2347 changed files with 62432 additions and 16731 deletions
|
|
@ -4,21 +4,21 @@ factorization, by analogy with the product rule for the derivative of a function
|
|||
used in mathematical analysis. Accordingly, for natural numbers n, the arithmetic
|
||||
derivative D(n) is defined as follows:
|
||||
|
||||
;*D(0) = D(1) = 0.
|
||||
;*D(p) = 1 for any prime p.
|
||||
;*D(mn) = D(m)n + mD(n) for any m,n ∈ N. (Leibniz rule for derivatives).
|
||||
;*<math>D(0) = D(1) = 0</math>.
|
||||
;*<math>D(p) = 1 \;\text{for any prime}\; p</math>.
|
||||
;*<math>D(mn) = D(m)n + mD(n) \;\text{for any}\; m,n \in N</math>. (Leibniz rule for derivatives).
|
||||
|
||||
Additionally, for negative integers the arithmetic derivative may be defined as -D(-n) (n < 0).
|
||||
Additionally, for negative integers the arithmetic derivative may be defined as <math>-D(-n) \;\text{for}\; (n < 0)</math>.
|
||||
|
||||
; Examples
|
||||
|
||||
D(2) = 1 and D(3) = 1 (both are prime) so if mn = 2 * 3, D(6) = (1)(3) + (1)(2) = 5.
|
||||
<math>D(2) = 1</math> and <math>D(3) = 1</math> (both are prime) so if <math>mn = 2 \cdot 3</math>, then <math>D(6) = D(2\cdot 3) = D(2)\cdot 3 + 2\cdot D(3) = 1\cdot 3 + 2\cdot 1 = 5</math>.
|
||||
|
||||
D(9) = D(3)(3) + D(3)(3) = 6
|
||||
<math>D(9) = D(3)\cdot 3 + 3\cdot D(3) = 1\cdot 3 + 3\cdot 1 = 6</math>
|
||||
|
||||
D(27) = D(3)*9 + D(9)*3 = 9 + 18 = 27
|
||||
<math>D(27) = D(3)\cdot 9 + 3\cdot D(9) = 1\cdot 9 + 3\cdot 6 = 27</math>
|
||||
|
||||
D(30) = D(5)(6) + D(6)(5) = 6 + 5 * 5 = 31.
|
||||
<math>D(30) = D(5)\cdot 6 + 5\cdot D(6) = 1\cdot 6 + 5 \cdot 5 = 31</math>.
|
||||
|
||||
; Task
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ Find and show the arithmetic derivatives for -99 through 100.
|
|||
|
||||
; Stretch task
|
||||
|
||||
Find (the arithmetic derivative of 10^m) then divided by 7, where m is from 1 to 20.
|
||||
Find (the arithmetic derivative of <math>10^m</math>) then divided by 7, where m is from 1 to 20.
|
||||
|
||||
; See also
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
D: $[x][
|
||||
when [
|
||||
x < 0 -> neg D neg x
|
||||
x = 0 -> 0
|
||||
x = 1 -> 0
|
||||
prime? x -> 1
|
||||
any [
|
||||
m: 2
|
||||
while [0 <> x % m] -> inc 'm
|
||||
n: x / m
|
||||
(n * D m) + m * D n
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
(neg 99)..100 | map => D
|
||||
| split.every:10
|
||||
| loop => [loop & 'n -> prints pad to :string n 5 print ""]
|
||||
print ""
|
||||
loop 20 'n -> print ~"D(10^|n|)/7 = |div D 10^n 7|"
|
||||
30
Task/Arithmetic-derivative/C-sharp/arithmetic-derivative.cs
Normal file
30
Task/Arithmetic-derivative/C-sharp/arithmetic-derivative.cs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
using System.Numerics;
|
||||
|
||||
static BigInteger Derivative(BigInteger k)
|
||||
{
|
||||
if (k < 0) return -Derivative(-k);
|
||||
if (k < 2) return 0;
|
||||
if (k.IsEven) return 2 * Derivative(k / 2) + k / 2;
|
||||
BigInteger m = 3;
|
||||
|
||||
while (m * m <= k && (k % m) != 0)
|
||||
m += 2;
|
||||
|
||||
var n = k / m;
|
||||
if (m * n != k || m == 1 || n == 1) return 1;
|
||||
return n * Derivative(m) + m * Derivative(n);
|
||||
}
|
||||
|
||||
for (var i = -99; i <= 100; i++)
|
||||
{
|
||||
Console.Write($"{Derivative(i),6}");
|
||||
if (i % 10 == 0) Console.WriteLine();
|
||||
}
|
||||
|
||||
BigInteger p = 1;
|
||||
|
||||
for (var n = 1; n <= 20; n++)
|
||||
{
|
||||
p *= 10;
|
||||
Console.WriteLine($"⅐ D(10^{n}) = {Derivative(p) / 7}");
|
||||
}
|
||||
|
|
@ -1,18 +1,12 @@
|
|||
func lagarias n .
|
||||
if n < 0
|
||||
return -lagarias -n
|
||||
.
|
||||
if n = 0 or n = 1
|
||||
return 0
|
||||
.
|
||||
if n < 0 : return -lagarias -n
|
||||
if n = 0 or n = 1 : return 0
|
||||
f = 2
|
||||
while n mod f <> 0
|
||||
f += 1
|
||||
.
|
||||
q = n / f
|
||||
if q = 1
|
||||
return 1
|
||||
.
|
||||
if q = 1 : return 1
|
||||
return q * lagarias f + f * lagarias q
|
||||
.
|
||||
for n = -99 to 100
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue