{"id":50847262,"url":"https://github.com/abhrankan-chakrabarti/pari-gp-scripts","last_synced_at":"2026-06-17T08:00:33.175Z","repository":{"id":364716925,"uuid":"1268730731","full_name":"Abhrankan-Chakrabarti/pari-gp-scripts","owner":"Abhrankan-Chakrabarti","description":"Bash wrappers for PARI/GP exploring classical number theory problems — Riemann zeta zeros and Gilbreath's conjecture.","archived":false,"fork":false,"pushed_at":"2026-06-14T09:38:50.000Z","size":25,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-14T11:15:55.943Z","etag":null,"topics":["bash","gilbreath-conjecture","mathematics","number-theory","pari-gp","riemann-zeta"],"latest_commit_sha":null,"homepage":"http://abhrankan.dpdns.org/pari-gp-scripts/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Abhrankan-Chakrabarti.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-13T21:47:39.000Z","updated_at":"2026-06-14T09:38:53.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/Abhrankan-Chakrabarti/pari-gp-scripts","commit_stats":null,"previous_names":["abhrankan-chakrabarti/pari-gp-scripts"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/Abhrankan-Chakrabarti/pari-gp-scripts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abhrankan-Chakrabarti%2Fpari-gp-scripts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abhrankan-Chakrabarti%2Fpari-gp-scripts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abhrankan-Chakrabarti%2Fpari-gp-scripts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abhrankan-Chakrabarti%2Fpari-gp-scripts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Abhrankan-Chakrabarti","download_url":"https://codeload.github.com/Abhrankan-Chakrabarti/pari-gp-scripts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abhrankan-Chakrabarti%2Fpari-gp-scripts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34439296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-17T02:00:05.408Z","response_time":127,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","gilbreath-conjecture","mathematics","number-theory","pari-gp","riemann-zeta"],"created_at":"2026-06-14T11:00:24.039Z","updated_at":"2026-06-17T08:00:33.095Z","avatar_url":"https://github.com/Abhrankan-Chakrabarti.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PARI/GP Scripts\n\n![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)\n![Shell: Bash](https://img.shields.io/badge/Shell-Bash-4EAA25.svg)\n![PARI/GP](https://img.shields.io/badge/PARI%2FGP-required-blue.svg)\n\nA collection of lightweight Bash wrappers for **PARI/GP** exploring classical problems in number theory.\n\n---\n\n## Table of Contents\n- [Prerequisites](#prerequisites)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n- [Scripts](#scripts)\n  - [riemann_zeros.sh](#riemann_zerossh)\n  - [gilbreath.sh](#gilbreathsh)\n  - [prime_gaps.sh](#prime_gapssh)\n  - [mobius.sh](#mobiussh)\n- [Contributing](#contributing)\n- [License](#license)\n\n---\n\n## Prerequisites\n\nAll scripts require **PARI/GP** (a computer algebra system specialized in number theory).\n\n---\n\n## Installation\n\n* **Ubuntu / Debian:**\n  ```bash\n  sudo apt-get update\n  sudo apt-get install pari-gp\n  ```\n* **macOS (via Homebrew):**\n  ```bash\n  brew install pari\n  ```\n* **Fedora / RHEL:**\n  ```bash\n  sudo dnf install pari-gp\n  ```\n* **Android (Termux):**\n  ```bash\n  pkg install pari-gp\n  ```\n* **Windows:** Download the installer from [pari.math.u-bordeaux.fr](https://pari.math.u-bordeaux.fr/download.html)\n\n---\n\n## Quick Start\n\n```bash\ngit clone https://github.com/Abhrankan-Chakrabarti/pari-gp-scripts.git\ncd pari-gp-scripts\nchmod +x riemann_zeros.sh gilbreath.sh prime_gaps.sh mobius.sh\n./riemann_zeros.sh 10 30 38\n./gilbreath.sh 10000 1\n```\n\n---\n\n## Scripts\n\n### riemann_zeros.sh\n\nComputes the non-trivial zeros of the Riemann zeta function ζ(s) within a user-defined height range [n1, n2] on the critical line (Re(s) = 1/2).\n\nBecause non-trivial zeros always appear in complex conjugate pairs due to the symmetry of the zeta function (ζ(s̄) = ζ(s)‾), the output formats them using `0.5 +/- t*I` notation.\n\n**Usage:**\n```bash\n./riemann_zeros.sh [n1] [n2] [precision]\n```\n\n**Example:**\n```text\n$ ./riemann_zeros.sh 10 30 38\n\n1: 0.5 +/- 14.134725141734693790457251983562470271*I\n2: 0.5 +/- 21.022039638771554992628479593896902777*I\n3: 0.5 +/- 25.010857580145688763213790992562821819*I\n```\n\n**How it works:**\n1. Validates that `n1`, `n2`, and `precision` are positive integers and that `n1 \u003c= n2`\n2. Passes the parameters to a `gp -q` session\n3. Uses `lfuncreate(1)` and `lfunzeros()` to compute the imaginary parts of the zeros, then maps each `t` to `0.5 +/- t*I`\n\n---\n\n### gilbreath.sh\n\nGenerates a Gilbreath Triangle for the first `n` primes and verifies **Gilbreath's conjecture** at each row.\n\nStarting from the sequence of the first `n` primes, each subsequent row is formed by taking the absolute differences of consecutive elements. Gilbreath's conjecture states that the first element of every row (after row 0) is always 1. It has been verified for millions of primes but remains unproven.\n\n**Usage:**\n```bash\n./gilbreath.sh [n] [quiet]\n```\n\n`quiet` is optional: `0` (default) prints every row, `1` suppresses row output and only prints the result and timing.\n\n**Example:**\n```text\n$ ./gilbreath.sh 6\n\nRow 0: [2, 3, 5, 7, 11, 13]\nRow 1: [1, 2, 2, 4, 2]\nRow 2: [1, 0, 2, 2]\nRow 3: [1, 2, 0]\nRow 4: [1, 2]\nRow 5: [1]\nGilbreath holds for first 6 primes\nTime: 0.001 s\n```\n\n**Quiet mode** (useful for large `n`):\n```text\n$ ./gilbreath.sh 5000 1\n\nGilbreath holds for first 5000 primes\nTime: 7.988 s\n```\n\n**How it works:**\n1. Validates that `n` is a positive integer\n2. Passes the parameters to `gp -q` via `echo | gp -q`\n3. Uses `primes(n)` to generate the initial row, then iterates absolute differences via `vector(#row-1, i, abs(row[i]-row[i+1]))`\n4. Reports computation time via PARI/GP's `gettime()`, formatted to 3 decimal places\n\n---\n\n### prime_gaps.sh\n\nComputes the maximum gap between consecutive primes for the first `n` primes. Uses a streaming loop rather than allocating a vector, so memory usage is O(1) and it scales to very large `n`.\n\n**Usage:**\n```bash\n./prime_gaps.sh [n]\n```\n\n**Example:**\n```text\n$ ./prime_gaps.sh 1000\n\nTotal Primes Processed: 1000\nLast Prime Reached:     7919\nMax gap found:          34\nTime elapsed:           0.012 s\n```\n\n**How it works:**\n1. Validates that `n` is an integer ≥ 2\n2. Iterates through primes using `prime(i)`, tracking `p_prev` and `p_curr` to compute each gap on the fly\n3. Reports total primes processed, last prime reached, maximum gap found, and elapsed time\n\n---\n\n### mobius.sh\n\nComputes the Möbius function μ(n) for all integers up to N.\n\nμ(n) is defined as: 1 if n = 1; (−1)^k if n is a product of k distinct primes; 0 if n has a squared prime factor.\n\n**Usage:**\n```bash\n./mobius.sh [N]\n```\n\n**Example:**\n```text\n$ ./mobius.sh 10\n\nn     μ(n)\n1     1\n2     -1\n3     -1\n4     0\n5     -1\n6     1\n7     -1\n8     0\n9     0\n10    1\nTime: 0.000 s\n```\n\n**How it works:**\n1. Validates that `N` is a positive integer\n2. Runs an optimized single-array sieve: for each prime `p`, zeros all multiples of `p²` first, then flips the sign of all non-zero multiples of `p` — half the memory footprint of the two-array approach with the same correctness\n3. Prints each value in an aligned table; Unicode header printed from bash to preserve the μ symbol; full table suppressed for N \u003e 1000\n\n---\n\n## Contributing\n\nPull requests are welcome. Ideas for new scripts include:\n\n- Goldbach partition checker\n- Dirichlet L-function zeros\n- Euler product approximations of π\n\nEach script should follow the conventions of the existing ones:\n\n- Bash wrapper with `gp` availability check\n- Argument mode with interactive prompt fallback\n- Input validation before passing to GP\n- Consistent header comment block (Title, Description, Dependencies)\n\n---\n\n## License\n\nThis project is licensed under the MIT License — see the [LICENSE](LICENSE) file for details.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabhrankan-chakrabarti%2Fpari-gp-scripts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabhrankan-chakrabarti%2Fpari-gp-scripts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabhrankan-chakrabarti%2Fpari-gp-scripts/lists"}