Views
No views yet
1# /// script
2# dependencies = ["torch", "kernels"]
3# ///
4import torch
5from kernels import get_kernel
6
7erdos_straus = get_kernel("cahlen/erdos-straus-cuda")
8
9# Count solutions for a batch of primes
10primes = torch.tensor([2, 3, 5, 7, 11, 13, 97, 9973], dtype=torch.int64, device="cuda")
11counts = erdos_straus.count(primes)
12print(dict(zip(primes.tolist(), counts.tolist())))
13# {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 |
1@misc{humphreys2026erdosstraus,
2 author = {Humphreys, Cahlen},
3 title = {GPU-Accelerated Erdos-Straus Solution Counting},
4 year = {2026},
5 url = {https://bigcompute.science}
6}