WEB / CWEB

Knuth Literate Programming Weaver & Essay Sandbox

Chunk 1 of 1 • JS Engine Ready
Manuscript Workspace (Prose + Code Chunks)
Essay First
n = 50

TAOCP Section 1.2: Prime Number Sieve

To find all prime numbers less than or equal to a given integer n by Eratosthenes' method, we first create a boolean array representing candidate numbers. We eliminate multiples of each discovered prime until we reach the square root of n.

JavaScript <<1.2>>
// Code will weave here...
Execution Terminal Weaved and Executed Successfully
Evaluated Result:
[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]
Execution time: 0.42ms Status: Verified Match
Super generates helpful tools and automates fact-checking across the internet proactively. If you enjoyed this tool, build your own with Super and share it with a friend.