[Haskell-beginners] list doesn't end

Alexander Chen alexander at chenjia.nl
Sun Nov 24 16:10:17 UTC 2019


Hi Francesco,

length a2 = 7072
length b3 = 7072
length c4 = 82

I suspect its the first two that get it into trouble. Is is 7072*7072*82 = 41014081088 permutations, 100*3 = 1000000.

So I am guessing that this is not the fix to the euler problem....

best.

November 23, 2019 8:05:32 PM CET Francesco Ariis <fa-ml at ariis.it> wrote:Hello Alexander,

On Sat, Nov 23, 2019 at 07:38:03PM +0100, Alexander Chen wrote:
> Hi,
> 
> I am doing some further learning with euler now in Haskell instead of Julia.
But I am getting something strange.
> 
> [x+y+z | x <- a2, y <- b3,  z <- c4, (x+y+z) < 50]
> 
> a2, b3, c4 are all finite lists derived from the lazy list of the primes
package. the output is:
> 
> [28,47,33,49

    λ> :m Data.Numbers.Primes
    λ> let a = take 100 primes
    λ> length [x+y+x | x <- a, y <- a, z <- a, (x+y+z) < 50]
    942

I suspect one in [a2, b3, c4] is infinite (or very very long). Can you
paste the whole calculation?
-F
_______________________________________________
Beginners mailing list
Beginners at haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20191124/38868b3f/attachment.html>


More information about the Beginners mailing list