Talk:Euler problems/121 to 130
From HaskellWiki
DonStewart (Talk  contribs) 

(7 intermediate revisions by 2 users not shown) 
Latest revision as of 08:43, 26 February 2008
On the Project Euler Forum I found the following solution for Problem 127, posted there by glguy.
main = print $ solve 99999
rad x = fromIntegral $ product $ map fst $ primePowerFactors $ fromIntegral x
solve :: Int > Int solve n = sum [ c  (rc,c) < invrads
, 2 * rc < c , (ra, a) < takeWhile (\(a,_)>(c > 2*rc*a)) invrads , a < c `div` 2 , gcd ra rc == 1 , ra * rads ! (c  a) < c `div` rc] where rads :: UArray Int Int rads = listArray (1,n) $ map rad [1..n] invrads = sort $ map (\(a,b) > (b, a)) $ assocs rads
Would responsible people be so kind as to check copyvio for this one? As far as I'm concerned it is. Just another thought: as you have solutions handy for most problems, couldn't those guarding these pages do the copyvio checking themselves? hk
If it was posted by glguy, I'm willing to bet he's okay with it being here, but I'll check with him. CaleGibbard 14:57, 25 February 2008 (UTC)
As far as I can see it was posted on this wiki by Lisp. In the meantime it becomes clear what damage Lisp has done. Many of the "solutions" on the lower pages that I commented on (and you deleted my comments), seem to have had better solutions before. Quale is trying to restore them. As I have nothing with Haskell (too slow an interpreted language according to my opinion) it's the selfcleaning power of this wiki community that you may hope for. I'm not going to help. I've had enough trouble with this so far. In fact you may thank the Project Euler community to have drawn attention to this "collection". hk
Just a remark: Haskell can be compiled  GHC is quite a good compiler for it, and typical performance of programs is usually only 2 or 3 times slower than what you'd normally get with C. CaleGibbard 21:37, 25 February 2008 (UTC)
Eric Mertens (glguy) has stated that he's happy for his solutions to appear on the wiki. dons 08:43, 26 February 2008 (UTC)