Thanks to rapid advances in technology, it's never been easier to put words on the Internet.
Prime numbers are positive integers
The $n$th prime number is commonly denoted
The Dirichlet generating function of the characteristic function of the prime numbers
where
{ data-filename="primes.hs" }
main :: IO ()
main = mapM_ print $ take 10 primes
primes :: [Integer]
primes = 2 : 3 : filter isPrime [5,7..]
isPrime :: Integer -> Bool
isPrime = null . primeDivisors
primeDivisors :: Integer -> [Integer]
primeDivisors n = [ p | p <- takeWhile ((<=n) . (^2)) primes, n `mod` p == 0 ]
graph LR
main --> primes
primes --> isPrime
isPrime --> primeDivisors
primeDivisors --> primes
Right | Left | Default | Centre |
---|---|---|---|
12 | 12 | 12 | 12 |
123 | 123 | 123 | 123 |
1 | 1 | 1 | 1 |