You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -560,6 +562,59 @@ Successfully exported 10 values to output.tsv
560
562
561
563
---
562
564
565
+
### von_mangoldt.sh
566
+
567
+
Computes the **von Mangoldt function** Λ(n) for all integers up to N. Λ(n) = log(p) if n = p^k for some prime p and integer k ≥ 1, and 0 otherwise. Also tracks the running **Chebyshev ψ function** ψ(N) = Σ Λ(k) for k = 1 to N, which is central to the prime number theorem and the explicit formula connecting prime distributions to Riemann zeta zeros.
568
+
569
+
**Usage:**
570
+
```bash
571
+
./von_mangoldt.sh [N] [output.tsv]
572
+
```
573
+
574
+
-`N` — upper bound (must be ≥ 1)
575
+
-`output.tsv` — optional export file for Λ(n) values
576
+
577
+
**Example:**
578
+
```text
579
+
$ ./von_mangoldt.sh 20
580
+
581
+
n Λ(n) note
582
+
--------------------------------
583
+
1 0
584
+
2 0.693147 p=2^1
585
+
3 1.098612 p=3^1
586
+
4 0.693147 p=2^2
587
+
5 1.609438 p=5^1
588
+
6 0
589
+
7 1.945910 p=7^1
590
+
8 0.693147 p=2^3
591
+
9 1.098612 p=3^2
592
+
10 0
593
+
11 2.397895 p=11^1
594
+
12 0
595
+
13 2.564949 p=13^1
596
+
14 0
597
+
15 0
598
+
16 0.693147 p=2^4
599
+
17 2.833213 p=17^1
600
+
18 0
601
+
19 2.944439 p=19^1
602
+
20 0
603
+
Chebyshev psi(20) = 19.265658
604
+
Calculation Time: 0.001 s
605
+
```
606
+
607
+
**How it works:**
608
+
1. Validates that `N` is a positive integer.
609
+
2. Factors each integer k up to N using PARI/GP's `factor(k)`.
610
+
3. If k has exactly one distinct prime factor p with any exponent, sets Λ(k) = log(p); otherwise Λ(k) = 0.
611
+
4. Accumulates the running Chebyshev ψ(N) = Σ Λ(k).
612
+
5. Terminal mode shows the prime base and exponent in a note column for prime powers.
613
+
6. TSV export uses the tagged stream pipeline (`DATA_START` / `DATA_END`) pattern consistent with `mobius.sh` and `liouville.sh`.
614
+
7. Reports ψ(N) and elapsed time via `gettime()`.
615
+
616
+
---
617
+
563
618
## 📊 Analytic Visualizations
564
619
565
620
Several scripts in this collection lend themselves to **visual analysis**. Beyond raw outputs, you can export results to TSV files and plot them to study convergence and distribution patterns.
0 commit comments