Lewati ke konten
Number Buffet

Koordinat spiral Ulam

Melingkarkan bilangan bulat ke luar dari sel tengah dan menandai bilangan prima, memunculkan garis diagonal yang dilihat Stanisław Ulam di kertas berpetak pada 1963.

4 menit baca

Pengaturan

Prasetel cepat

Odd sizes put the starting number exactly in the middle; an even size is rounded up by one.

The spiral runs from here to start + size² − 1. Try 41 for Euler’s prime-rich diagonal.

The grids are monospace art; the coordinate lists are data, one cell per row in spiral order.

Only used by the marked grid.

Pads each column with a space so the square grid reads square in a monospace font, where character cells are about twice as tall as they are wide.

Setel tampilan

Pilih dulu salah satu prasetel di samping gambar — kendali ini menyesuaikannya.

Frame

A border drawn inside the edge of the image.

Lanjutan

Hasil

25 nilai

█ · · · · · █ · █ · · · · · █ · · · · · █ · · · ·, · · · · · · · █ · · · · · · · · · · · █ · · · █ ·, · · █ · · · █ · · · · · · · █ · · · · · █ · · · ·, · █ · · · · · · · · · █ · · · █ · █ · · · █ · █ ·, · · · · █ · · · · · █ · · · · · · · · · █ · █ · ·, · · · · · █ · · · █ · █ · · · · · · · · · · · · ·, · · · · · · · · · · · · █ · █ · · · · · █ · · · █, · █ · · · █ · █ · · · █ · · · · · · · █ · · · █ ·, · · · · · · · · · · · · █ · █ · · · █ · · · · · ·, · · · █ · · · █ · █ · · · · · █ · █ · █ · · · · ·, █ · █ · █ · █ · █ · █ · · · █ · · · · · · · █ · ·, · · · · · · · · · · · █ · █ · █ · · · · · · · · ·, · · · · · · █ · · · █ · · █ █ · █ · █ · █ · · · █, · · · · · · · █ · █ · █ · · · · · · · · · · · · ·, · · · · · · · · █ · · · █ · · · · · · · · · · · ·, · █ · █ · · · █ · █ · · · █ · · · █ · █ · · · █ ·, █ · · · █ · · · █ · · · · · █ · · · · · █ · █ · ·, · · · · · · · · · █ · · · · · · · · · · · █ · · ·, · · · · █ · █ · · · · · █ · · · █ · · · █ · · · ·, · █ · · · █ · · · · · · · · · · · █ · · · · · · ·, · · █ · · · · · █ · · · █ · █ · · · · · · · · · ·, · · · · · · · █ · █ · · · █ · · · · · █ · · · █ ·, █ · █ · · · · · · · · · █ · █ · · · · · █ · · · ·, · · · █ · · · · · · · · · · · █ · █ · · · · · · ·, █ · · · · · █ · · · · · █ · · · █ · █ · · · · · ·

25×25 = 625 consecutive integers, 1 to 625, of which 114 are prime (18.2%). 1 sits in the middle; the walk goes right, then up, then left, and so on outward. Columns are space-padded to keep the grid square on screen.


Buat gambar

Aktifkan JavaScript untuk memberi gaya pada angka-angka ini dan mengunduhnya sebagai gambar. Nilainya sendiri sudah terdaftar di atas.

Text on the image

Drag a line straight onto the picture to place it — once placed, it stays exactly where you put it. Everything here is drawn into the download.

Artikel latar belakang di bawah belum diterjemahkan dan ditampilkan dalam bahasa Inggris.

Tentang koordinat spiral ulam

Stanisław Ulam found the pattern in 1963. Martin Gardner's account has him doodling through the presentation of a long and very boring paper at a scientific meeting: he wrote the integers in a square spiral on graph paper and circled the primes, and they did not scatter — they clumped along diagonal lines. Ulam was by then a senior figure at Los Alamos — Manhattan Project, the Teller–Ulam design, the Monte Carlo method — so he had a computer within reach. With Myron Stein and Mark Wells he used the laboratory's MANIAC II to extend the picture to roughly 100,000 points. It reached a general audience in March 1964, when Scientific American ran Gardner's Mathematical Games column on the spiral and put it on the front cover of that issue.

The diagonals are real, and they stop being mysterious once you ask what a line in the spiral is. Walk outward from the centre along any ray — diagonal, horizontal or vertical — and the values have a constant second difference of 8, so each ray is the value set of some quadratic 4x² + bx + c. Some quadratics are much richer in primes than others. Euler published the extreme case in 1772: x² + x + 41 is prime for every x from 0 to 39. Centre a spiral on 41 and that polynomial falls along one diagonal, which duly shows up as an unbroken streak of forty primes.

How much richer a given quadratic is was addressed by G. H. Hardy and J. E. Littlewood in their 1923 Partitio Numerorum paper on the Goldbach conjecture. Its Conjecture F asserts an asymptotic formula for the number of primes of the form ax² + bx + c, with a constant depending on the particular polynomial; the predicted densities differ enough between polynomials to produce exactly the light-and-dark contrast the eye picks out. Conjecture F remains unproven, and the gap is wider still: nobody has shown that any irreducible quadratic represents infinitely many primes. The x² + 1 case is Landau's fourth problem, posed in 1912 and still open.

A note on priority: in 1932, thirty-one years before Ulam's doodle, the herpetologist Laurence Klauber constructed a triangular, non-spiral array of the integers that shows much the same prime-rich lines. Gardner mentioned it only in a later addendum.

Sifat utama

  • The walk places the centre number, then the consecutive integers one cell at a time — right, up, left, left, down, down, right, right, right — with run lengths 1, 1, 2, 2, 3, 3, and so on, which fills an odd n×n square in exactly n² cells and ends in a corner.
  • A grid of n cells per side therefore spans exactly n² consecutive integers: 101×101 covers 10,201 of them.
  • Consecutive integers occupy orthogonally adjacent cells, so a number’s parity tracks the grid’s checkerboard colouring: every odd number — hence every prime except 2 — lands on a cell whose coordinates sum to an even number.
  • A diagonal step preserves the parity of x + y, so a diagonal line stays inside one colour class, while a row or column alternates between a class that can hold primes and one that cannot. That is why the diagonals, not the rows, carry the visible structure.
  • Along any ray out from the centre the values have a constant second difference of 8, so every such ray is the value set of a quadratic 4x² + bx + c.
  • With 1 at the centre, the four diagonal rays take the values 4k² + 1, 4k² − 2k + 1, 4k² + 2k + 1 and (2k + 1)². The last of these is the odd squares, so that diagonal is entirely free of primes.
  • With 41 at the centre, the two arms of one diagonal take the values 4k² − 2k + 41 and 4k² + 2k + 41, which are Euler’s x² + x + 41 at odd and even x respectively. Since that polynomial is prime for x = 0 to 39, the diagonal runs 40 cells without a gap and then breaks at 41² = 1681.
  • It is not known whether any irreducible quadratic polynomial represents infinitely many primes, and Hardy and Littlewood’s Conjecture F, which predicts how many each one should produce, is unproven.

Di mana muncul

  • The March 1964 issue of Scientific American carried the spiral on its cover, alongside Martin Gardner’s column on primes — the route by which most people first met it, and the reason it became a fixture of recreational mathematics.
  • Ulam, Myron Stein and Mark Wells extended the picture to about 100,000 points on the MANIAC II at Los Alamos Scientific Laboratory — an early case of computer graphics used to pose a mathematical question rather than settle one.
  • Drawing the spiral is a stock programming exercise: Rosetta Code carries it as the task "Ulam spiral (for primes)", with implementations in dozens of languages, because it exercises nested-loop indexing and a prime sieve at once.
  • Prime-rich quadratics spotted on the spiral are the standard worked examples when polynomials with long initial runs of primes are discussed; Euler’s x² + x + 41 and its relatives are still the ones everyone reaches for.
  • Rearrangements of the same idea recur: Robert Sacks devised a variant in 1994 that winds the integers along an Archimedean spiral instead of a square one, and Klauber’s 1932 triangle is an earlier non-spiral layout with a comparable effect. Which lines look most striking is a property of the layout chosen, not of the primes.

Cara memakai generator ini

Nilai yang dihasilkan muncul di bagian atas, dengan tombol salin di sebelahnya. Untuk menjadikannya gambar, pilih tampilan dari gaya di bawah Buat gambar, tentukan ukuran ekspor, lalu unduh sebagai PNG, JPEG, atau WebP. Semuanya digambar di peramban, jadi tidak ada yang kamu hasilkan dikirim ke server.

Bilah alamat ikut berubah saat kamu bekerja, jadi tautannya selalu menghasilkan persis apa yang kamu lihat — berguna untuk membagikan barisan tertentu atau menyimpan sebuah pengaturan. Pakai Salin untuk mengambil nilainya sebagai teks biasa, atau Ekspor data untuk CSV, JSON, NDJSON, SQL, dan XML.

Sumber

Ringkasan sejarah di halaman ini bersandar pada rujukan berlisensi terbuka yang didaftar di atas. Menemukan kekeliruan? Beri tahu kami dan akan kami perbaiki.