Copy the prompt and paste it into a new session in Claude Science. By default, Claude asks with a permission card before it runs code or installs packages.
Prompt
In 1963 the mathematician Stanisław Ulam, doodling during a long and boring talk, wrote the whole numbers in a square spiral and circled the primes. Recreate his picture. Find all primes up to 40,401 (= 201 × 201) with a sieve of Eratosthenes, and check that 1,229 of them are below 10,000. Write 1, 2, 3, … in a square spiral starting from the center, and mark the primes.Are the diagonal streaks real, or is my eye fooling me? Draw the same picture with the same number of randomly chosen odd numbers. For every diagonal of odd numbers at least 100 cells long, in both directions, compute the share of marked cells, and compare its standard deviation and range in the 2 pictures.Then highlight the numbers n² + n + 41 (Euler's polynomial). On this spiral about the first 40 values wind around the center, and from then on they run along 2 straight diagonals. How many of the first 100 are prime, and how many would you expect from typical odd numbers of that size? The first one that is not prime is n = 40, which gives 41 × 41. Which diagonals are rich in primes is predicted by a conjecture of Hardy and Littlewood (1923) that is still unproven: mention it, and describe the rich and poor diagonals without accounting for them. Walk me through your method at undergraduate level.
Yes. On Ulam’s 1963 spiral of 1 to 40,401, the share of primes per diagonal runs from 0 to 48%, against roughly 11 to 32% for as many random odd numbers. Over the 202 diagonals of at least 100 cells that spread is about 2.3 times the random one, so the streaks are real. The sieve finds 4,236 primes, 1,229 of them below 10,000, as published. Euler’s n² + n + 41 traces the 2 richest streaks (over 70% prime along its 2 rays, each one half of a diagonal, running outward from the diagonal’s cell nearest the center): prime for n = 0 to 39, and for 86 of its first 100 values, where typical odd numbers of that size would give about 29 of 100.
This example doesn’t download any data.Reference: M. L. Stein, S. M. Ulam and M. B. Wells, ‘A visual display of some properties of the distribution of primes’, American Mathematical Monthly 71, 516–520 (1964)
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Claude.ai Documentation","colors":{"primary":"#0E0E0E","light":"#D4A27F","dark":"#0E0E0E"},"logo":{"light":"https://mintcdn.com/claude-ai/1fyDNLAICe3KG6rB/logo/light.svg?fit=max\u0026auto=format\u0026n=1fyDNLAICe3KG6rB\u0026q=85\u0026s=e870c19cb781d8a7c7b7d19de53b0a10","dark":"https://mintcdn.com/claude-ai/1fyDNLAICe3KG6rB/logo/dark.svg?fit=max\u0026auto=format\u0026n=1fyDNLAICe3KG6rB\u0026q=85\u0026s=80cc0b06d8fd9aeefec8acb226de6866"},"favicon":"https://mintcdn.com/claude-ai/N9YeVEPVxANlc2We/favicon.ico?fit=max\u0026auto=format\u0026n=N9YeVEPVxANlc2We\u0026q=85\u0026s=a22e48fa0189917f9be516d4a555898c","background":{"color":{"light":"#FDFDF7","dark":"#09090B"}},"navbar":{"links":[{"href":"https://support.anthropic.com","label":"Support"}],"primary":{"type":"button","label":"Go to Claude","href":"https://claude.ai"}},"footer":{"socials":{"x":"https://x.com/AnthropicAI","linkedin":"https://www.linkedin.com/company/anthropicresearch"},"links":[{"header":"Company","items":[{"label":"Anthropic","href":"https://www.anthropic.com/company"},{"label":"Careers","href":"https://www.anthropic.com/careers"},{"label":"Economic Futures","href":"https://www.anthropic.com/economic-futures"},{"label":"Research","href":"https://www.anthropic.com/research"},{"label":"News","href":"https://www.anthropic.com/news"},{"label":"Trust center","href":"https://trust.anthropic.com/"},{"label":"Transparency","href":"https://www.anthropic.com/transparency"}]},{"header":"Help and security","items":[{"label":"Availability","href":"https://www.anthropic.com/supported-countries"},{"label":"Status","href":"https://status.anthropic.com/"},{"label":"Support center","href":"https://support.claude.com/"}]},{"header":"Learn","items":[{"label":"Courses","href":"https://academy.claude.com/"},{"label":"MCP connectors","href":"https://claude.com/partners/mcp"},{"label":"Customer stories","href":"https://www.claude.com/customers"},{"label":"Engineering blog","href":"https://www.anthropic.com/engineering"},{"label":"Events","href":"https://www.anthropic.com/events"},{"label":"Powered by Claude","href":"https://claude.com/partners/powered-by-claude"},{"label":"Service partners","href":"https://claude.com/partners/services"},{"label":"Startups program","href":"https://claude.com/programs/startups"}]},{"header":"Terms and policies","items":[{"label":"Privacy policy","href":"https://www.anthropic.com/legal/privacy"},{"label":"Disclosure policy","href":"https://www.anthropic.com/responsible-disclosure-policy"},{"label":"Usage policy","href":"https://www.anthropic.com/legal/aup"},{"label":"Commercial terms","href":"https://www.anthropic.com/legal/commercial-terms"},{"label":"Consumer terms","href":"https://www.anthropic.com/legal/consumer-terms"}]}]},"seo":{"metatags":{"canonical":"https://claude.com/docs"}},"fonts":{"family":"Anthropic Sans"},"contextual":{"options":["copy","view","claude"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"claude-ai","hasAudioNarration":false,"actualSubdomain":"claude-ai","customDomains":["claude.com"],"gitSource":{"type":"github","owner":"anthropics","repo":"claude-ai-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6aecd2323e88da70853022de","collectionId":"6ad27b7d-e90c-4d06-9bdb-9519e02f46e8","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6aecd2323e88da70853022de"},"feedback":{"thumbs":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"ENABLED"},"CONTEXTUAL_FEEDBACK":{"status":"ENABLED"},"CODE_SNIPPET_FEEDBACK":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6aed151869a2ec0c40a68b0f","clientVersion":"0.0.4074","searchFilterCounts":[{"language":"default","tag":"Claude Tag","count":76},{"language":"default","tag":"For administrators","count":61},{"language":"default","tag":"Claude for Government","count":44},{"language":"default","tag":"Claude on third-party platforms","count":42},{"language":"default","tag":"Claude Desktop","count":42},{"language":"default","tag":"Claude Science","count":41},{"language":"default","tag":"Build for Claude","count":30},{"language":"default","tag":"Set up Claude Tag","count":30},{"language":"default","tag":"Use Claude Science","count":23},{"language":"default","tag":"Customize Claude","count":22}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"/docs","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","href":"/docs/_mintlify/custom/claude-ai/f864c4801ebb83ca/style.css"}],"page":{"pagePath":"claude-science/example-gallery/math-ulam","slug":"/claude-science/example-gallery/math-ulam","pageMetadata":{"title":"The Ulam spiral: are the primes' diagonal streaks real?","sidebarTitle":"Ulam spiral","description":"Compare the share of primes per diagonal on Ulam's 1963 spiral of 1 to 40,401 against as many random odd numbers.","keywords":["mathematics"],"href":"/claude-science/example-gallery/math-ulam"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Compare the share of primes per diagonal on Ulam’s 1963 spiral of 1 to 40,401 against as many random odd numbers.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,p:`p`,pre:`pre`,span:`span`,..._provideComponents(),...props.components},{CodeBlock,Frame,Heading,OptimizedImage}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Frame)_missingMdxReference(`Frame`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);return _jsxs(_Fragment,{children:[_jsx(`div`,{className:`example-gallery-page`,children:_jsxs(Frame,{children:[_jsx(OptimizedImage,{className:`mint-block dark:mint-hidden`,src:`https://mintcdn.com/claude-ai/F2QP9ubtYgT0edFI/images/claude-science/example-gallery/math-ulam-full-light.webp?fit=max\u0026auto=format\u0026n=F2QP9ubtYgT0edFI\u0026q=85\u0026s=140ca573e05d853818df9ab149c1f064`,alt:`Primes up to 40,401 on Ulam's spiral, with primes of n² + n + 41 in orange along 2 rays; as many random odd numbers, with no streaks; and histograms of each diagonal's share, wider for the primes.`,\"data-og-width\":`1600`,width:`1600`,\"data-og-height\":`632`,height:`632`,\"data-path\":`images/claude-science/example-gallery/math-ulam-full-light.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/claude-ai/F2QP9ubtYgT0edFI/images/claude-science/example-gallery/math-ulam-full-light.webp?w=280\u0026fit=max\u0026auto=format\u0026n=F2QP9ubtYgT0edFI\u0026q=85\u0026s=958628a8004cc055f70033fcc9ecd59f 280w, https://mintcdn.com/claude-ai/F2QP9ubtYgT0edFI/images/claude-science/example-gallery/math-ulam-full-light.webp?w=560\u0026fit=max\u0026auto=format\u0026n=F2QP9ubtYgT0edFI\u0026q=85\u0026s=1ce303e5485a79c80d5da3d4eb8ffc32 560w, https://mintcdn.com/claude-ai/F2QP9ubtYgT0edFI/images/claude-science/example-gallery/math-ulam-full-light.webp?w=840\u0026fit=max\u0026auto=format\u0026n=F2QP9ubtYgT0edFI\u0026q=85\u0026s=8fd64e4dcb88421a2406eafbff6fcde6 840w, https://mintcdn.com/claude-ai/F2QP9ubtYgT0edFI/images/claude-science/example-gallery/math-ulam-full-light.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=F2QP9ubtYgT0edFI\u0026q=85\u0026s=60f91b2fb4e56279b6167d88ffbc6eb6 1100w, https://mintcdn.com/claude-ai/F2QP9ubtYgT0edFI/images/claude-science/example-gallery/math-ulam-full-light.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=F2QP9ubtYgT0edFI\u0026q=85\u0026s=d2bbd3df4dfc143540d922ed86e759c2 1650w, https://mintcdn.com/claude-ai/F2QP9ubtYgT0edFI/images/claude-science/example-gallery/math-ulam-full-light.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=F2QP9ubtYgT0edFI\u0026q=85\u0026s=d76fc3b13030a3c7dc730b0928cdb36e 2500w`}),_jsx(OptimizedImage,{className:`mint-hidden dark:mint-block`,src:`https://mintcdn.com/claude-ai/F2QP9ubtYgT0edFI/images/claude-science/example-gallery/math-ulam-full-dark.webp?fit=max\u0026auto=format\u0026n=F2QP9ubtYgT0edFI\u0026q=85\u0026s=fac8550c8919a1486851d6287563661b`,alt:`Primes up to 40,401 on Ulam's spiral, with primes of n² + n + 41 in orange along 2 rays; as many random odd numbers, with no streaks; and histograms of each diagonal's share, wider for the primes.`,\"data-og-width\":`1600`,width:`1600`,\"data-og-height\":`632`,height:`632`,\"data-path\":`images/claude-science/example-gallery/math-ulam-full-dark.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/claude-ai/F2QP9ubtYgT0edFI/images/claude-science/example-gallery/math-ulam-full-dark.webp?w=280\u0026fit=max\u0026auto=format\u0026n=F2QP9ubtYgT0edFI\u0026q=85\u0026s=aa9f37db33bbdd106c15ff9873f9b050 280w, https://mintcdn.com/claude-ai/F2QP9ubtYgT0edFI/images/claude-science/example-gallery/math-ulam-full-dark.webp?w=560\u0026fit=max\u0026auto=format\u0026n=F2QP9ubtYgT0edFI\u0026q=85\u0026s=39be6ace401829eb10f80103104d15cf 560w, https://mintcdn.com/claude-ai/F2QP9ubtYgT0edFI/images/claude-science/example-gallery/math-ulam-full-dark.webp?w=840\u0026fit=max\u0026auto=format\u0026n=F2QP9ubtYgT0edFI\u0026q=85\u0026s=785cbafa467bc2b9776a136b53ba1221 840w, https://mintcdn.com/claude-ai/F2QP9ubtYgT0edFI/images/claude-science/example-gallery/math-ulam-full-dark.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=F2QP9ubtYgT0edFI\u0026q=85\u0026s=e9448da49556146a515f7c876e54ddb4 1100w, https://mintcdn.com/claude-ai/F2QP9ubtYgT0edFI/images/claude-science/example-gallery/math-ulam-full-dark.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=F2QP9ubtYgT0edFI\u0026q=85\u0026s=65c0725ab7d2725c610dddaaf8899cb1 1650w, https://mintcdn.com/claude-ai/F2QP9ubtYgT0edFI/images/claude-science/example-gallery/math-ulam-full-dark.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=F2QP9ubtYgT0edFI\u0026q=85\u0026s=c77a16cab8ff8cb16c579737b23cb83e 2500w`})]})}),`\n`,_jsxs(_components.p,{children:[`The numbers in your session might differ from this picture and from the summary in `,_jsx(_components.a,{href:`#reference-analysis`,children:`Reference analysis`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`prompt`,children:`Prompt`}),`\n`,_jsxs(_components.p,{children:[`Copy the prompt and paste it into a new session in `,_jsx(_components.a,{href:`/claude-science/overview`,children:`Claude Science`}),`. By default, Claude asks with a `,_jsx(_components.a,{href:`/claude-science/core-concepts#permission-cards`,children:`permission card`}),` before it runs code or installs packages.`]}),`\n`,_jsx(CodeBlock,{filename:`Prompt`,wrap:`true`,numberOfLines:`6`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`6`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`In 1963 the mathematician Stanisław Ulam, doodling during a long and boring talk, wrote the whole numbers in a square spiral and circled the primes. Recreate his picture. Find all primes up to 40,401 (= 201 × 201) with a sieve of Eratosthenes, and check that 1,229 of them are below 10,000. Write 1, 2, 3, … in a square spiral starting from the center, and mark the primes.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Are the diagonal streaks real, or is my eye fooling me? Draw the same picture with the same number of randomly chosen odd numbers. For every diagonal of odd numbers at least 100 cells long, in both directions, compute the share of marked cells, and compare its standard deviation and range in the 2 pictures.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Then highlight the numbers n² + n + 41 (Euler's polynomial). On this spiral about the first 40 values wind around the center, and from then on they run along 2 straight diagonals. How many of the first 100 are prime, and how many would you expect from typical odd numbers of that size? The first one that is not prime is n = 40, which gives 41 × 41. Which diagonals are rich in primes is predicted by a conjecture of Hardy and Littlewood (1923) that is still unproven: mention it, and describe the rich and poor diagonals without accounting for them. Walk me through your method at undergraduate level.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(Heading,{level:`2`,id:`reference-analysis`,children:`Reference analysis`}),`\n`,_jsx(_components.p,{children:`Yes. On Ulam’s 1963 spiral of 1 to 40,401, the share of primes per diagonal runs from 0 to 48%, against roughly 11 to 32% for as many random odd numbers. Over the 202 diagonals of at least 100 cells that spread is about 2.3 times the random one, so the streaks are real. The sieve finds 4,236 primes, 1,229 of them below 10,000, as published. Euler’s n² + n + 41 traces the 2 richest streaks (over 70% prime along its 2 rays, each one half of a diagonal, running outward from the diagonal’s cell nearest the center): prime for n = 0 to 39, and for 86 of its first 100 values, where typical odd numbers of that size would give about 29 of 100.`}),`\n`,_jsx(Heading,{level:`2`,id:`data`,children:`Data`}),`\n`,_jsx(_components.p,{children:`This example doesn’t download any data.`}),`\n`,_jsx(_components.p,{children:`Reference: M. L. Stein, S. M. Ulam and M. B. Wells, ‘A visual display of some properties of the distribution of primes’, American Mathematical Monthly 71, 516–520 (1964)`})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"The Ulam spiral: are the primes' diagonal streaks real?","sidebarTitle":"Ulam spiral","description":"Compare the share of primes per diagonal on Ulam's 1963 spiral of 1 to 40,401 against as many random odd numbers.","keywords":["mathematics"],"href":"/claude-science/example-gallery/math-ulam"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Prompt","slug":"prompt","depth":2,"children":[]},{"title":"Reference analysis","slug":"reference-analysis","depth":2,"children":[]},{"title":"Data","slug":"data","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/docs/_mintlify/custom/claude-ai/b857db804a3a9481/desktop-app-nav.js"],"dynamicCss":".mint-block {\n display: block\n}\n.mint-hidden {\n display: none\n}\n.dark\\:mint-block:is(.dark *) {\n display: block\n}\n.dark\\:mint-hidden:is(.dark *) {\n display: none\n}","subdomain":"claude-ai","siteName":"Claude.ai Documentation","title":"The Ulam spiral: are the primes' diagonal streaks real? - Claude.ai Documentation","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-16T16:02:20.297Z","originalFileLocation":"claude-science/example-gallery/math-ulam.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Compare the share of primes per diagonal on Ulam\u0026#x27;s 1963 spiral of 1 to 40,401 against as many random odd numbers.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Claude.ai Documentation\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/claude-ai/zHw4o4W7dZma2XXV/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/docs/mintlify-assets/_mintlify/favicons/claude-ai/zHw4o4W7dZma2XXV/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/claude-ai/zHw4o4W7dZma2XXV/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/claude-ai/zHw4o4W7dZma2XXV/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/claude-ai/zHw4o4W7dZma2XXV/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/claude-ai/zHw4o4W7dZma2XXV/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/claude-ai/zHw4o4W7dZma2XXV/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/claude-ai/zHw4o4W7dZma2XXV/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/claude-ai/zHw4o4W7dZma2XXV/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"The Ulam spiral: are the primes\u0026#x27; diagonal streaks real? - Claude.ai Documentation\">\u003cmeta data-mint-head property=\"og:description\" content=\"Compare the share of primes per diagonal on Ulam\u0026#x27;s 1963 spiral of 1 to 40,401 against as many random odd numbers.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Claude.ai Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://claude.com/docs/claude-science/example-gallery/math-ulam\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://claude-ai.mintlify.site/docs/_mintlify/api/og/v2?division=Example+gallery\u0026amp;title=The+Ulam+spiral%3A+are+the+primes%27+diagonal+streaks+real%3F\u0026amp;description=Compare+the+share+of+primes+per+diagonal+on+Ulam%27s+1963+spiral+of+1+to+40%2C401+against+as+many+random+odd+numbers.\u0026amp;theme=c937feb09b37748e448783d0\u0026amp;signature=98a26a5ee9b4a3cd279a36331fc0ebc093a99a9ca4e2ca85837831eb8ebafe27\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"The Ulam spiral: are the primes\u0026#x27; diagonal streaks real? - Claude.ai Documentation\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Compare the share of primes per diagonal on Ulam\u0026#x27;s 1963 spiral of 1 to 40,401 against as many random odd numbers.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://claude-ai.mintlify.site/docs/_mintlify/api/og/v2?division=Example+gallery\u0026amp;title=The+Ulam+spiral%3A+are+the+primes%27+diagonal+streaks+real%3F\u0026amp;description=Compare+the+share+of+primes+per+diagonal+on+Ulam%27s+1963+spiral+of+1+to+40%2C401+against+as+many+random+odd+numbers.\u0026amp;theme=c937feb09b37748e448783d0\u0026amp;signature=98a26a5ee9b4a3cd279a36331fc0ebc093a99a9ca4e2ca85837831eb8ebafe27\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/docs/mintlify-assets/_mintlify/favicons/claude-ai/zHw4o4W7dZma2XXV/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Claude.ai Documentation\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0E0E0E\">\u003clink data-mint-head rel=\"canonical\" href=\"https://claude.com/docs/claude-science/example-gallery/math-ulam\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/claude-science/example-gallery/math-ulam.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://claude.com/#organization\",\"name\":\"Claude.ai Documentation\",\"url\":\"https://claude.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/claude-ai/1fyDNLAICe3KG6rB/logo/light.svg?fit=max\u0026auto=format\u0026n=1fyDNLAICe3KG6rB\u0026q=85\u0026s=e870c19cb781d8a7c7b7d19de53b0a10\"}},{\"@type\":\"WebSite\",\"@id\":\"https://claude.com/docs#website\",\"name\":\"Claude.ai Documentation\",\"url\":\"https://claude.com/docs\",\"publisher\":{\"@id\":\"https://claude.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://claude.com/docs/claude-science/example-gallery/math-ulam#webpage\",\"url\":\"https://claude.com/docs/claude-science/example-gallery/math-ulam\",\"name\":\"The Ulam spiral: are the primes' diagonal streaks real?\",\"description\":\"Compare the share of primes per diagonal on Ulam's 1963 spiral of 1 to 40,401 against as many random odd numbers.\",\"dateModified\":\"2026-10-16T16:02:20.297Z\",\"isPartOf\":{\"@id\":\"https://claude.com/docs#website\"},\"breadcrumb\":{\"@id\":\"https://claude.com/docs/claude-science/example-gallery/math-ulam#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://claude.com/docs/claude-science/example-gallery/math-ulam#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Use Claude Science\",\"item\":\"https://claude.com/docs/claude-science/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Example gallery\",\"item\":\"https://claude.com/docs/claude-science/example-gallery\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"The Ulam spiral: are the primes' diagonal streaks real?\",\"item\":\"https://claude.com/docs/claude-science/example-gallery/math-ulam\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://claude.com/docs/claude-science/example-gallery/math-ulam#article\",\"headline\":\"The Ulam spiral: are the primes' diagonal streaks real?\",\"name\":\"The Ulam spiral: are the primes' diagonal streaks real?\",\"description\":\"Compare the share of primes per diagonal on Ulam's 1963 spiral of 1 to 40,401 against as many random odd numbers.\",\"url\":\"https://claude.com/docs/claude-science/example-gallery/math-ulam\",\"mainEntityOfPage\":{\"@id\":\"https://claude.com/docs/claude-science/example-gallery/math-ulam#webpage\"},\"dateModified\":\"2026-10-16T16:02:20.297Z\",\"keywords\":\"mathematics\",\"publisher\":{\"@id\":\"https://claude.com/#organization\"},\"isPartOf\":{\"@id\":\"https://claude.com/docs#website\"}}]}\u003c/script>","siteName":"Claude.ai Documentation","nav":{"global":null,"tabs":[{"tab":"Welcome","pages":[{"title":"Welcome","href":""}]},{"tab":"Customize Claude","pages":[{"title":"Customize Claude","href":"/extend/overview"}]},{"tab":"Build for Claude","pages":[{"title":"Build for Claude","href":"/build/overview"}]},{"tab":"Cowork","pages":[{"title":"Cowork","href":"/cowork/overview"}]},{"tab":"Claude Tag","pages":[{"title":"Claude Tag","href":"/claude-tag/overview"}]},{"tab":"Claude for M365","pages":[{"title":"Claude for M365","href":"/office-agents/overview"}]},{"tab":"Claude Science","groups":[{"group":"Use Claude Science","pages":[{"title":"Claude Science","sidebarTitle":"Claude Science","href":"/claude-science/overview"},{"title":"Get started","sidebarTitle":"Get started","href":"/claude-science/get-started"},{"title":"Claude Science in its own window on macOS","sidebarTitle":"Mac app window","href":"/claude-science/mac-app-window"},{"title":"Update Claude Science","sidebarTitle":"Update","href":"/claude-science/update-claude-science"},{"title":"Run on a remote Linux server","sidebarTitle":"Run on a remote server","href":"/claude-science/run-on-remote-linux-server"},{"title":"Core concepts","sidebarTitle":"Core concepts","href":"/claude-science/core-concepts"},{"group":"Example gallery","root":{"title":"Example gallery","mode":"wide","href":"/claude-science/example-gallery"},"pages":[{"title":"Genetic drift in a bottle: Buri's 107 fruit-fly populations","sidebarTitle":"Genetic drift in a bottle","href":"/claude-science/example-gallery/bio-drift"},{"title":"A titration curve from the full equilibrium: which indicator finds the equivalence point?","sidebarTitle":"Titration curve","href":"/claude-science/example-gallery/chem-titration"},{"title":"A first Kaplan–Meier curve: the 1963 leukemia trial of 6-MP","sidebarTitle":"Kaplan–Meier curve","href":"/claude-science/example-gallery/clin-km"},{"title":"PageRank on a web of 11 pages: why 1 good link beats 6 weak ones","sidebarTitle":"PageRank, 11 pages","href":"/claude-science/example-gallery/cs-pagerank-tiny"},{"title":"A first finite-element model: a clamped steel ruler bends and vibrates","sidebarTitle":"Cantilever beam","href":"/claude-science/example-gallery/eng-beam"},{"title":"A first X-ray diffraction pattern: why silicon shows 6 peaks and salt 9","sidebarTitle":"X-ray diffraction","description":"Simulate the X-ray powder patterns of silicon and table salt and label every peak with Bragg's law.","href":"/claude-science/example-gallery/mat-xrd"},{"title":"The Ulam spiral: are the primes' diagonal streaks real?","sidebarTitle":"Ulam spiral","href":"/claude-science/example-gallery/math-ulam"},{"title":"The double slit, one electron at a time","sidebarTitle":"Electron double slit","description":"Rebuild the picture of Tonomura's 1989 experiment with an ideal double slit: each electron lands as 1 random dot, yet fringes 10.7 µm apart build up.","href":"/claude-science/example-gallery/phys-doubleslit"},{"title":"Schelling's segregation model: ask for 30% same-color neighbors, end up with 75%","sidebarTitle":"Schelling's segregation model","href":"/claude-science/example-gallery/soc-schelling-small"}]},{"title":"Safeguards","sidebarTitle":"Safeguards","href":"/claude-science/safeguards"},{"title":"Auto mode","sidebarTitle":"Auto mode","href":"/claude-science/auto-mode"},{"title":"Use Claude Science on more than one computer","sidebarTitle":"Multiple computers","href":"/claude-science/multiple-computers"},{"title":"Artifacts in Claude Science","sidebarTitle":"Artifacts","href":"/claude-science/artifacts"},{"title":"Comments","sidebarTitle":"Comments","href":"/claude-science/comments"},{"title":"The reviewer","sidebarTitle":"The reviewer","href":"/claude-science/the-reviewer"},{"title":"Tools and environments","sidebarTitle":"Tools and environments","href":"/claude-science/tools-and-environments"},{"title":"Troubleshoot Claude Science","sidebarTitle":"Troubleshooting","href":"/claude-science/troubleshooting"}]},{"group":"Integrations \u0026 skills","pages":[{"title":"Connectors and skills","sidebarTitle":"Connectors and skills","href":"/claude-science/connectors-and-skills"},{"title":"Remote compute clusters","sidebarTitle":"Remote compute clusters","href":"/claude-science/remote-compute-clusters"},{"title":"Compute providers","sidebarTitle":"Compute providers","href":"/claude-science/compute-providers"},{"title":"Cloud storage","sidebarTitle":"Cloud storage","href":"/claude-science/cloud-storage"},{"title":"Literature access","sidebarTitle":"Literature access","href":"/claude-science/literature-access"},{"title":"Custom connectors","sidebarTitle":"Custom connectors","href":"/claude-science/custom-connectors"}]},{"group":"For administrators","pages":[{"title":"Enable Claude Science","sidebarTitle":"Enable Claude Science","href":"/claude-science/enable-claude-science"},{"title":"How Claude Science works with your data","sidebarTitle":"How Claude Science works with your data","href":"/claude-science/how-claude-science-works-with-your-data"},{"title":"Admin controls","sidebarTitle":"Admin controls","href":"/claude-science/admin-controls"},{"title":"Manage Claude Science on devices","sidebarTitle":"Manage on devices","href":"/claude-science/manage-on-devices"},{"title":"Use Claude Science on a corporate network","sidebarTitle":"Corporate networks","href":"/claude-science/corporate-networks"},{"title":"Network requirements","sidebarTitle":"Network requirements","href":"/claude-science/network-requirements"},{"title":"Monitor Claude Science usage","sidebarTitle":"Monitor usage","href":"/claude-science/monitor-usage"}]},{"group":"Reference","pages":[{"title":"Glossary","sidebarTitle":"Glossary","href":"/claude-science/glossary"},{"title":"Command line settings","sidebarTitle":"Command line settings","href":"/claude-science/command-line-settings"},{"title":"Configuration file reference","sidebarTitle":"Configuration reference","href":"/claude-science/configuration-file-reference"}]},{"group":"Resources","pages":[{"title":"Claude Science changelog","sidebarTitle":"Changelog","href":"/claude-science/changelog"},{"title":"Legal and compliance","sidebarTitle":"Legal and compliance","href":"/claude-science/legal-and-compliance"}]}]},{"tab":"Claude on third-party platforms","pages":[{"title":"Claude on third-party platforms","href":"/third-party/claude-desktop/overview"}]},{"tab":"Claude self-hosted","hidden":true,"pages":[{"title":"Claude self-hosted","href":"/third-party/claude-desktop/self-hosted/overview"}]},{"tab":"Claude for Government","pages":[{"title":"Claude for Government","href":"/government/overview"}]}]},"basePath":"","title":"The Ulam spiral: are the primes' diagonal streaks real? - Claude.ai Documentation","buildId":"dpl_CEsowfH15TDzsBT2BFbX312Be4Ct","deploymentId":"dpl_CEsowfH15TDzsBT2BFbX312Be4Ct","dynamics":["07c022d89b","a74be98ba7"],"chunks":["Frame-E5itAVSN.js","DynamicMarkdown-DORtg_Te.js","zoom-image-lightbox-OBZHPeVn.js","lightbox-handle-r17bVUz3.js"]}