# Ulam Folio

> Sixty thousand integers as fine grains on a dark plate, with the primes lit so the diagonal streaks of the square spiral show, plus a loupe, five layouts and a live prime census.

- Type: Lab Skill (downloadable Agent Skill)
- Category: [Interactive 3D](https://www.sandbase.ai/skills/interactive-3d)
- Version: 1.0.1
- Runs online: yes
- Page: https://www.sandbase.ai/skills/interactive-3d/ulam-folio

## What you get

Bring a range of integers and a layout to arrange them in. The Skill returns a downloadable Skill and a runnable prime-spiral scene.

## Install

Download the Skill package from https://www.sandbase.ai/skills/interactive-3d/ulam-folio (sign-in required), unzip it into your agent's skills folder, then ask your agent to use it:

```text
/ulam-folio build a prime-spiral plate for <your number range and layout>
```

## How it works

1. **Build the prime plate page** Ulam Folio builds with npm install, which adds playwright-core for the checks only, then npm run build for a bilingual dist/index.html or npm run build:zh for the Chinese-only plate. Everything is Canvas 2D drawn by code with no image assets or network requests. The page places the integers 1 to 60,000, or 30,000 on narrow screens, as fine grains on a dark plate.
2. **Sieve, morph and explore layouts** An Eratosthenes sieve in src/spiral.js marks the primes, and five layouts, row, line, the Ulam square walk, the Sacks coil and a polar seed, morph with each point delayed by its square root so changes ripple outward. Press and hold for a numbered loupe that lights both diagonals, drag to pan, scroll to zoom, and use keys 1 to 5 for layouts.
3. **Shoot the maths and verify** npm run shoot checks the sieve count against trial division, the square-walk coordinates of 1 and 9, a morph that settles, k squared plus k plus 41 giving 40 primes before 1681, the Euler tag on 41 and 500 primality spot checks. It writes dist/shoot-report.json and shoot-spiral.png. verify.mjs proves five interactions under the sandbox CSP.

## FAQ

### What does Ulam Folio show?

Ulam Folio shows up to 60,000 integers as grains on a dark plate, with the primes gathering into the diagonal streaks of the Ulam square walk. An instrument column offers five layouts, a range dial, overlays for twin pairs, the k squared plus k plus 41 chain and composite dust, a live census and a histogram of prime gaps.

### Are the primes in Ulam Folio computed or stored?

Ulam Folio computes them. A sieve runs in the page, and the census of pi(n), n over ln n, their ratio, twin couples and the widest gap, plus the gap histogram, come from the same pass. The shoot check compares the count with trial division.

### Does Ulam Folio need a key or network?

No. Ulam Folio has no runtime model calls, image assets or network requests; playwright-core is installed only for the checks. Exploring any range on the plate is therefore free of SandBase charges.

### Why do diagonals stop being straight in other Ulam Folio layouts?

Ulam Folio highlights diagonals using the square walk's coordinates. In the coil, seed or other layouts the lit cells are the same numbers, but they no longer sit on a straight line.

### Can Ulam Folio show more than 60,000 numbers?

No. Ulam Folio fixes the grain count at build time by screen width, 60,000 or 30,000, and the range dial can only show fewer. On load a sieve front sweeps outward through the count, then a light runs along the most prime-rich diagonals.

### Does Ulam Folio work with reduced motion?

Yes. Ulam Folio skips the entrance sweep, the diagonal light, the ring pulse and the automatic layout tour when reduced motion is on. The loupe, panning, zoom and layout tiles still work as usual.

## Examples

- Ulam Folio prime plate (scene)
- Primes on the Plate (video)
