Downloads · 30 days
0
cahlen/erdos-straus-cuda
erdos-straus-cuda is a machine learning model from cahlen. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for kernels. The card lists the license as mit.
GPU kernel for counting solutions \\(f(p)\\) to the Erdos-Straus equation:
Downloads · 30 days
0
Access
Public
Updated Apr 14, 2026
Repo size
618 KB
Likes
0
Public
Click a slice to open those files.
.so307 KB · 97%
From the Hugging Face model README
GPU kernel for counting solutions \(f(p)\) to the Erdos-Straus equation:
$$\frac{4}{p} = \frac{1}{x} + \frac{1}{y} + \frac{1}{z}$$
for each prime \(p\), where \(x \leq y \leq z\).
The Erdos-Straus conjecture (1948) asserts that \(f(p) \geq 1\) for all primes \(p \geq 2\). This kernel computes the exact count of ordered solutions for every prime in a batch.
# /// script
# dependencies = ["torch", "kernels"]
# ///
import torch
from kernels import get_kernel
erdos_straus = get_kernel("cahlen/erdos-straus-cuda")
# Count solutions for a batch of primes
primes = torch.tensor([2, 3, 5, 7, 11, 13, 97, 9973], dtype=torch.int64, device="cuda")
counts = erdos_straus.count(primes)
print(dict(zip(primes.tolist(), counts.tolist())))
# {2: 1, 3: 3, 5: 2, 7: 5, 11: 8, 13: 12, 97: 251, 9973: 62624}
erdos_straus.count(primes: Tensor) -> Tensor| Parameter | Type | Description |
|---|---|---|
primes | Tensor[int64] (1-D, CUDA) | Batch of primes to count solutions for |
| Returns | Tensor[int32] (1-D, CUDA) | Solution count \(f(p)\) for each prime |
For each prime \(p\), the kernel enumerates all valid \((x, y, z)\) triples:
Each thread handles one prime. Throughput scales linearly with GPU cores.
Verified on 8x NVIDIA B200 GPUs at bigcompute.science:
All data open at github.com/cahlen/idontknow.
@misc{humphreys2026erdosstraus,
author = {Humphreys, Cahlen},
title = {GPU-Accelerated Erdos-Straus Solution Counting},
year = {2026},
url = {https://bigcompute.science}
}
Human-AI collaborative research. Not peer-reviewed. All code and data open for verification.