Timeline for Project Euler problem 92 (sequences formed by the sum of squares of digits) in Haskell
Current License: CC BY-SA 3.0
14 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 16, 2015 at 20:35 | vote | accept | Ben | ||
Jul 20, 2015 at 15:54 | answer | added | max taldykin | timeline score: 2 | |
Jul 20, 2015 at 1:21 | answer | added | Toxaris | timeline score: 6 | |
Jul 20, 2015 at 1:04 | history | edited | 200_success | CC BY-SA 3.0 |
edited title
|
Jul 20, 2015 at 0:48 | answer | added | 200_success | timeline score: 3 | |
Jul 20, 2015 at 0:06 | history | edited | 200_success | CC BY-SA 3.0 |
added 4 characters in body; edited title; edited tags
|
Jul 19, 2015 at 21:08 | comment | added | Caridorc | very probable, by the way I like that you declared your functions on the Int type, removing those declarations would slow down the code. | |
Jul 19, 2015 at 21:06 | comment | added | Ben |
@Caridorc That didn't change anything. Takes exactly the same time (both with -O2 , that is). Maybe that's because the Haskell compiler optimised it already?
|
|
Jul 19, 2015 at 20:52 | comment | added | Caridorc | I can't test now but using a lazy range may speed up your code: lenght $ takeWhile (<= 9999999) $ filter chainTo89 [1..] | |
Jul 19, 2015 at 20:47 | comment | added | Ben |
@Caridorc I did now, and it does seem to make quite a difference. I got it down to 36 secs. I didn't time the non -O2 version, but it definitely was considerably longer (minutes).
|
|
Jul 19, 2015 at 20:34 | comment | added | Caridorc |
Have you compiled at -O2 ? The Haskell compiler is pretty good at optimizing.
|
|
Jul 19, 2015 at 20:32 | comment | added | Caridorc |
Not a full answer but squareDigits should be named square as it works on any sequence of numbers not only digits.
|
|
Jul 19, 2015 at 20:28 | history | edited | Ben | CC BY-SA 3.0 |
added 226 characters in body
|
Jul 19, 2015 at 20:22 | history | asked | Ben | CC BY-SA 3.0 |