{"id":50050494,"url":"https://github.com/nmicic/k-tuplet-search","last_synced_at":"2026-05-21T09:05:09.483Z","repository":{"id":358854624,"uuid":"1228109944","full_name":"nmicic/k-tuplet-search","owner":"nmicic","description":"k-tuplet-search","archived":false,"fork":false,"pushed_at":"2026-05-19T09:36:20.000Z","size":1877,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-19T12:21:16.272Z","etag":null,"topics":["computational-number-theory","cuda","experimental-mathematics","gmp","gpu-computing","high-performance-computing","hpc","k-tuplets","number-theory","primality-testing","prime-numbers","prime-tuples","sieve"],"latest_commit_sha":null,"homepage":"https://nmicic.github.io/k-tuplet-search/","language":"Cuda","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nmicic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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":"NOTICE","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-03T15:56:26.000Z","updated_at":"2026-05-19T10:59:08.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/nmicic/k-tuplet-search","commit_stats":null,"previous_names":["nmicic/k-tuplet-search"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/nmicic/k-tuplet-search","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmicic%2Fk-tuplet-search","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmicic%2Fk-tuplet-search/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmicic%2Fk-tuplet-search/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmicic%2Fk-tuplet-search/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nmicic","download_url":"https://codeload.github.com/nmicic/k-tuplet-search/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmicic%2Fk-tuplet-search/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33295283,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-21T02:57:32.698Z","status":"ssl_error","status_checked_at":"2026-05-21T02:57:31.990Z","response_time":62,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["computational-number-theory","cuda","experimental-mathematics","gmp","gpu-computing","high-performance-computing","hpc","k-tuplets","number-theory","primality-testing","prime-numbers","prime-tuples","sieve"],"created_at":"2026-05-21T09:05:00.521Z","updated_at":"2026-05-21T09:05:09.474Z","avatar_url":"https://github.com/nmicic.png","language":"Cuda","funding_links":[],"categories":[],"sub_categories":[],"readme":"# k-Tuplet Prime Search\n\nA CUDA+GMP search engine and tooling suite for prime k-tuplets. The project is\ncode-first: it can replay known records, enumerate and validate admissible\npatterns, and run long GPU campaigns, but this repository does **not** claim a\nnew k-tuplet record.\n\nSibling project to\n[cunningham-chain-search](https://github.com/nmicic/cunningham-chain-search).\nThe filter architecture is a port of that search style: the Cunningham-chain\nformula `2^i*n + (2^i - 1)` is replaced by additive shifts `n + b_i`.\n\n## Architecture\n\nThe production search pipeline is:\n\n- **Pattern catalog**: admissible offset sets in `src/common/ktuplet_pattern.c`\n- **Wheel expressions**: CRT-surviving base positions for plain primorial\n  wheels up to `47#` or structural quotient wheels such as `47#/31/17`\n- **GPU filter**: `src/cuda/kt_filter_v8.cu` rejects candidates with a staged\n  forbidden-residue cascade (`L2 -\u003e ext-L2 -\u003e line-sieve -\u003e Fermat-2`)\n- **Host prover**: GMP/BPSW verification of every member of surviving tuplets\n- **Operational support**: `--validate-known`, random/sequential prefix modes,\n  prefix lanes, checkpoint/resume, JSONL hit persistence, and benchmark tooling\n\n## Pattern Catalog\n\nThe CUDA engine catalog contains 97 admissible narrow-diameter patterns across\n`k=3..28`. It is generated from `tools/patterns/catalog/*.json` by\n`tools/gen_pattern_header.py`, including reflected patterns as separate search\ndirections where applicable.\n\nNorman Luhn's pattern and Hardy-Littlewood tables are the authoritative\nmathematical reference. The local enumeration tools are convenience code for\nengine input; cross-check them before using the output in external claims.\n\n| k | Patterns | Diameter H(k) |\n|---|----------|---------------|\n| 3 | 2 | 6 |\n| 4 | 1 | 8 |\n| 5 | 2 | 12 |\n| 6 | 1 | 16 |\n| 7 | 2 | 20 |\n| 8 | 3 | 26 |\n| 9 | 4 | 30 |\n| 10 | 2 | 32 |\n| 11 | 2 | 36 |\n| 12 | 2 | 42 |\n| 13 | 6 | 48 |\n| 14 | 2 | 50 |\n| 15 | 4 | 56 |\n| 16 | 2 | 60 |\n| 17 | 4 | 66 |\n| 18 | 2 | 70 |\n| 19 | 4 | 76 |\n| 20 | 2 | 80 |\n| 21 | 2 | 84 |\n| 22 | 4 | 90 |\n| 23 | 2 | 94 |\n| 24 | 4 | 100 |\n| 25 | 18 | 110 |\n| 26 | 2 | 114 |\n| 27 | 8 | 120 |\n| 28 | 10 | 126 |\n\nThe GP/PARI toolkit currently carries a smaller 25-entry planning catalog\n(`k=5,7,9,16..24`) and a generated record table. Use the C catalog for the\nfull CUDA engine pattern list.\n\n## Search Status\n\nThe known-record replay corpus covers `k=16..21` and is used as the main\ncorrectness gate. Practical record-search examples in this repo focus on\n`k=19`, `k=20`, and `k=21`; `k\u003e=22` is exploratory frontier territory. Luhn's\nrecords page states that large known examples are maintained through `k=21`,\nwith no known `k\u003e21` examples except near the beginning of the prime sequence.\n\nThe included longevity infrastructure was used for stability testing and random\nsampling. Treat those runs as stress tests, not as exhaustive coverage of the\n100-bit search ranges.\n\n## Quick Start\n\n### Build the GPU Engine\n\nUbuntu/Debian dependencies:\n\n```bash\nsudo apt update\nsudo apt install -y build-essential libgmp-dev\nsudo apt install -y pari-gp          # optional: only needed for gp/ tools\n```\n\n```bash\ncd src/cuda\nmake kt_filter_v8\n```\n\nThe Makefile defaults to `/usr/local/cuda-13.2/bin/nvcc` and `sm_120`\n(RTX 5090 / Blackwell). Override as needed:\n\n```bash\nmake kt_filter_v8 NVCC=/path/to/nvcc NVCC_ARCH=sm_89\n```\n\nFor Blackwell/`sm_120`, use a CUDA toolkit that knows that architecture\n(validated with CUDA 13.2). If `nvcc` reports that `sm_120` is not defined,\ninstall a newer CUDA toolkit or build for an older GPU with `NVCC_ARCH=sm_89`,\n`sm_86`, etc.\n\nFor Ada/`sm_89` targets such as RTX 4090, use CUDA 11.8 or newer.\n\n### Run Tests and Inspect Patterns\n\n```bash\n./kt_filter_v8 --test\n./kt_filter_v8 --list-patterns\n```\n\n`--list-patterns` prints every compiled pattern name accepted by `--pattern`,\nwith tuple length, diameter, and offset list. See\n[`docs/CUDA_CLI_REFERENCE.md`](docs/CUDA_CLI_REFERENCE.md) for all CLI options.\n\nRelease validation snapshot, 2026-05-18: `kt_filter_v8` built with CUDA 13.2\nfor `sm_120` on an RTX 5090 host, and `./kt_filter_v8 --test` reported\n`All 52 tests passed`.\n\n### Try a Wheel-Expression Search\n\nPlain `--primorial N` searches use all primes through the selected wheel. For\ncampaign cells that intentionally vary the Stage-0 wheel shape, `--wheel-expr`\naccepts quotient-style expressions:\n\n```bash\n./kt_filter_v8 --pattern KT19_P0 --bits 99 --wheel-expr '47#/31' --random --max-time 1800\n./kt_filter_v8 --pattern KT20_P1 --bits 100 --wheel-expr '47#/29' --random --max-time 1800\n```\n\n`47#/31` means \"use all wheel primes through 47, except 31\". Dropped primes\nmust be smaller than the wheel ceiling; use `43#`, not `47#/47`, for the lower\nplain wheel. One expression is active per process; run multiple processes or\nGPUs to sample multiple wheel shapes. See [`HOWTO.md`](HOWTO.md) and\n[`docs/CUDA_CLI_REFERENCE.md`](docs/CUDA_CLI_REFERENCE.md) for the grammar and\noperational tradeoffs.\n\n### Validate Known Records\n\n```bash\n./kt_filter_v8 --validate-known 19 --primorial 13\n./kt_filter_v8 --validate-known 20 --primorial 14 --validate-per-record-budget 90\n```\n\nExit code 0 and `validate-known: gate=PASS` mean the selected replay gate\nreproduced at least one known record per configured tier.\n\n## GP/PARI Library\n\n```bash\ngp -q\n\\r gp/kt_lib_v1.gp\n```\n\n39 self-tests run automatically. Then optionally load the generated record\ntable:\n\n```gp\n\\r gp/records.gp\nkt_check_record_table(KT_RECORDS, 5)    \\\\ verify 5 records per k\n```\n\nSee [`gp/HOWTO_kt_lib_v1.md`](gp/HOWTO_kt_lib_v1.md) for full usage.\n\n## Record Corpus\n\n[`known/records.json`](known/records.json) contains 227 records across\n`k=16..21`, sourced from Norman Luhn's\n[k-tuplet history pages](https://pzktupel.de/KTHIST/) at\n[pzktupel.de](https://pzktupel.de). Credit for maintaining those records\nbelongs to Norman Luhn and the original discoverers listed in the corpus.\n\nRegeneration commands:\n\n```bash\npython3 tools/fetch_records.py          # refresh known/records.json from pzktupel.de\npython3 tools/parse_records_json.py     # regenerate tools/records_manifest.tsv\npython3 tools/records_to_gp.py          # regenerate gp/records.gp\npython3 tools/gen_pattern_header.py     # regenerate src/common/ktuplet_pattern.{h,c}\n```\n\n## Project Layout\n\n| Directory | Contents |\n|-----------|----------|\n| `src/cuda/` | Production GPU engine (`kt_filter_v8.cu`) and oracle engine (`kt_filter_v5.cu`) |\n| `src/common/` | Shared pattern catalog, verification helpers, and JSON parser |\n| `src/cpu/` | CPU search/prover (`kt_gmp_v1.c`) using GMP |\n| `gp/` | GP/PARI toolkit and generated record table |\n| `tools/` | Record importers, pattern generators, and benchmark utilities |\n| `docs/` | Design notes and pattern-tool documentation |\n| `known/` | Known-record corpus (`records.json`) |\n| `longevity_gpu/` | Remote GPU longevity-run scripts |\n| `visualizations/` | Interactive k-tuplet analyzer ([GitHub Pages](https://nmicic.github.io/k-tuplet-search/visualizations/k-tuplet-analyzer/index.html)) |\n\n## Quick Links\n\n| What | Where |\n|------|-------|\n| GPU engine (production) | [`src/cuda/kt_filter_v8.cu`](src/cuda/kt_filter_v8.cu) |\n| GPU oracle | [`src/cuda/kt_filter_v5.cu`](src/cuda/kt_filter_v5.cu) |\n| GPU engine guide | [`src/cuda/README.md`](src/cuda/README.md) |\n| CPU engine guide | [`src/cpu/README.md`](src/cpu/README.md) |\n| Pattern catalog (C) | [`src/common/ktuplet_pattern.c`](src/common/ktuplet_pattern.c) |\n| Pattern header | [`src/common/ktuplet_pattern.h`](src/common/ktuplet_pattern.h) |\n| Pattern tools | [`docs/PATTERN_TOOLS.md`](docs/PATTERN_TOOLS.md) |\n| CUDA CLI reference | [`docs/CUDA_CLI_REFERENCE.md`](docs/CUDA_CLI_REFERENCE.md) |\n| GP/PARI library | [`gp/kt_lib_v1.gp`](gp/kt_lib_v1.gp) |\n| GP library guide | [`gp/HOWTO_kt_lib_v1.md`](gp/HOWTO_kt_lib_v1.md) |\n| Record corpus | [`known/records.json`](known/records.json) |\n| Record manifest | [`tools/records_manifest.tsv`](tools/records_manifest.tsv) |\n| Interactive analyzer | [GitHub Pages](https://nmicic.github.io/k-tuplet-search/visualizations/k-tuplet-analyzer/index.html) / [`visualizations/k-tuplet-analyzer/index.html`](visualizations/k-tuplet-analyzer/index.html) |\n| GPU HOWTO | [`HOWTO.md`](HOWTO.md) |\n| Testing and benchmarks | [`TESTING.md`](TESTING.md) |\n\n## AI Assistance\n\nThis project used AI-assisted development tools during implementation,\ntesting, and documentation review. All code and release decisions remain the\nresponsibility of the author.\n\n## External Links\n\n- [k-tuplet records (pzktupel.de)](https://www.pzktupel.de/ktuplets.php)\n- [Patterns and Hardy-Littlewood constants](https://pzktupel.de/ktpatt_hl.php)\n- [Cunningham chain search (sibling project)](https://github.com/nmicic/cunningham-chain-search)\n\n## Author\n\nNenad Mićić \u003cnenad@micic.be\u003e, Belgium\n\n## License\n\nApache-2.0 - see [LICENSE](LICENSE) and [NOTICE](NOTICE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnmicic%2Fk-tuplet-search","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnmicic%2Fk-tuplet-search","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnmicic%2Fk-tuplet-search/lists"}