Skip to content

Instantly share code, notes, and snippets.

@WillNess
Last active December 17, 2015 09:08
Show Gist options
  • Select an option

  • Save WillNess/5584750 to your computer and use it in GitHub Desktop.

Select an option

Save WillNess/5584750 to your computer and use it in GitHub Desktop.
enum & search 500 X 500
Prelude Data.List> length [(x, y*y) | y <-[1..31], a<-[1..499],
b<-[a..div 500 a-1], let x=a*b, 5<x, x<500, mod y x == 0]
85
(0.41 secs, 16891796 bytes)
Prelude Data.List> length [(x, y*y) | y <-[1..31], a<-[1..499],
b<-[a..div 500 a-1], let x=a*b, 5<x, mod y x == 0]
85
(0.37 secs, 15572324 bytes)
-- http://news.gmane.org/find-root.php?message_id=%3cEAC01DCF%2d1443%2d4FC2%2d9904%2d4F938FAC7C81%40cs.otago.ac.nz%3e
-- http://stackoverflow.com/questions/16552650/haskell-list-comprehension-cant-enumerate-n-n#comment23802769_16552650
-- https://groups.google.com/forum/?fromgroups=#!topic/haskell-cafe/fK1jJ3SSaUE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment