Project Euler 8 - Haskell

后端 未结 2 1883
深忆病人
深忆病人 2021-01-21 12:58

Going through Project Euler I am comparing my solutions to the ones here.

For question 8 my code produces the correct answer (confirmed via the check sum on the website)

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-21 13:14

    What is happening is that digitToInt returns an Int, which on 32-bit systems is too short to hold the test numbers when 5 is increased to 13. Change it to (fromIntegral . digitToInt) and it works correctly.

提交回复
热议问题