ninetynine-1.3.0: Ninety-Nine Haskell Problems
CopyrightCopyright (C) 2021 Yoo Chung
LicenseGPL-3.0-or-later
Maintainerdev@chungyc.org
Safe HaskellSafe-Inferred
LanguageGHC2021

Problems.P41

Description

Part of Ninety-Nine Haskell Problems. Some solutions are in Solutions.P41.

Synopsis

Documentation

goldbachList :: Integral a => a -> a -> [(a, a)] Source #

Given a range of integers by its lower and upper limit, return a list of all Goldbach compositions for the even numbers in the range.

In most cases, if an even number is written as the sum of two prime numbers, one of them is very small. Very rarely, it cannot be a sum of primes for which at least one is smaller than, say, 50. Try to find out how many such cases there are in the range \([2,3000]\).

Examples

>>> goldbachList 9 20
[(3,7),(5,7),(3,11),(3,13),(5,13),(3,17)]
>>> filter (\(m,n) -> m > 100 && n > 100) $ goldbachList 2 3000
[(103,2539)]