[Haskell-beginners] Project euler question

Daniel Fischer daniel.is.fischer at googlemail.com
Wed May 21 21:18:15 UTC 2014


On Wednesday 21 May 2014, 22:09:24, martin wrote:
> Hello all,
> 
> I tried to solve Problem 24 (https://projecteuler.net/problem=24) and came
> up with the following solution:

> 
> solution = filter isDigit $ show $ (x !! 1000001)
> -- "2783915640"
> 
> PE tells me that this is wrong,

Yes, you took the 1000002nd element. List indexing is 0-based, so the 
millionth element is at index (1000000 - 1), not (1000000 + 1).


More information about the Beginners mailing list