[Haskell-beginners] Project euler question

martin martin.drautzburg at web.de
Thu May 22 06:36:48 UTC 2014


Am 05/21/2014 11:18 PM, schrieb Daniel Fischer:
> 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).

Oops.



More information about the Beginners mailing list