Skip to content

Commit be96702

Browse files
docs: add von_mangoldt.sh to README
1 parent 22adda1 commit be96702

1 file changed

Lines changed: 56 additions & 1 deletion

File tree

README.md

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Thus, **Remote Exec Server & Client** was born — a minimal, dependency‑free
3939
- [dirichlet_zeros.sh](#dirichlet_zerossh)
4040
- [Zero Spacing Analysis](#-zero-spacing-analysis)
4141
- [liouville.sh](#liouvillesh)
42+
- [von_mangoldt.sh](#von_mangoldtsh)
4243
- [Analytic Visualizations](#-analytic-visualizations)
4344
- [Contributing](#contributing)
4445
- [License](#license)
@@ -79,7 +80,7 @@ All scripts require **PARI/GP** (a computer algebra system specialized in number
7980
```bash
8081
git clone https://github.com/Abhrankan-Chakrabarti/pari-gp-scripts.git
8182
cd pari-gp-scripts
82-
chmod +x riemann_zeros.sh gilbreath.sh prime_gaps.sh mobius.sh goldbach.sh euler_pi.sh dirichlet_zeros.sh liouville.sh
83+
chmod +x riemann_zeros.sh gilbreath.sh prime_gaps.sh mobius.sh goldbach.sh euler_pi.sh dirichlet_zeros.sh liouville.sh von_mangoldt.sh
8384
./riemann_zeros.sh 10 30 38
8485
./gilbreath.sh 10000 1
8586
./prime_gaps.sh 1000
@@ -88,6 +89,7 @@ chmod +x riemann_zeros.sh gilbreath.sh prime_gaps.sh mobius.sh goldbach.sh euler
8889
./euler_pi.sh 10
8990
./dirichlet_zeros.sh 5 2 10 30 38
9091
./liouville.sh 10
92+
./von_mangoldt.sh 20
9193
```
9294

9395
---
@@ -560,6 +562,59 @@ Successfully exported 10 values to output.tsv
560562

561563
---
562564

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+
563618
## 📊 Analytic Visualizations
564619

565620
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

Comments
 (0)