Re: [Haskell-cafe] Zumkeller numbers

2009-12-09 Thread ajb
G'day all. Quoting Dan Weston : Ouch. That's what happens when you let a machine do the translation. How about: "Once your good name is trashed, you can live unabashed." "Until you've lost your reputation, you never realize what a burden it was." -- Margaret Mitchell Cheers, Andrew Brom

Re: [Haskell-cafe] Zumkeller numbers

2009-12-09 Thread Dan Weston
Ouch. That's what happens when you let a machine do the translation. How about: "Once your good name is trashed, you can live unabashed." David Virebayre wrote: On Wed, Dec 9, 2009 at 11:47 AM, Henning Thielemann wrote: Ist der Ruf erst ruiniert, lebt es sich ganz ungeniert. 8-] Is ther

Re: [Haskell-cafe] Zumkeller numbers

2009-12-09 Thread David Virebayre
On Wed, Dec 9, 2009 at 11:47 AM, Henning Thielemann wrote: > Ist der Ruf erst ruiniert, lebt es sich ganz ungeniert. 8-] > Is there an English translation of it? Google translate says : "If the reputation is ruined, one can live quite openly." David. ___

Re: [Haskell-cafe] Zumkeller numbers

2009-12-09 Thread Daniel Fischer
Am Mittwoch 09 Dezember 2009 11:47:49 schrieb Henning Thielemann: > On Wed, 9 Dec 2009, Daniel Fischer wrote: > > Am Mittwoch 09 Dezember 2009 00:02:30 schrieb Lennart Augustsson: > >> And if you use quotRem it's faster (unless you're running on some > >> exotic hardware like NS32K). > > > > Yes, b

Re: [Haskell-cafe] Zumkeller numbers

2009-12-09 Thread Henning Thielemann
On Wed, 9 Dec 2009, Daniel Fischer wrote: Am Mittwoch 09 Dezember 2009 00:02:30 schrieb Lennart Augustsson: And if you use quotRem it's faster (unless you're running on some exotic hardware like NS32K). Yes, but Henning Thielemann was busy in the exception vs. error thread, so I didn't want

Re: [Haskell-cafe] Zumkeller numbers

2009-12-08 Thread Daniel Fischer
Am Mittwoch 09 Dezember 2009 00:02:30 schrieb Lennart Augustsson: > And if you use quotRem it's faster (unless you're running on some > exotic hardware like NS32K). Yes, but Henning Thielemann was busy in the exception vs. error thread, so I didn't want to distract him by using quotRem :D __

Re: [Haskell-cafe] Zumkeller numbers

2009-12-08 Thread Lennart Augustsson
And if you use quotRem it's faster (unless you're running on some exotic hardware like NS32K). On Tue, Dec 8, 2009 at 10:19 PM, Richard O'Keefe wrote: > > On Dec 9, 2009, at 1:15 AM, Daniel Fischer wrote: > >> Am Dienstag 08 Dezember 2009 08:44:52 schrieb Ketil Malde: >>> >>> "Richard O'Keefe" w

Re: [Haskell-cafe] Zumkeller numbers

2009-12-08 Thread Richard O'Keefe
On Dec 9, 2009, at 1:15 AM, Daniel Fischer wrote: Am Dienstag 08 Dezember 2009 08:44:52 schrieb Ketil Malde: "Richard O'Keefe" writes: factors n = [m | m <- [1..n], mod n m == 0] -- saves about 10% time, seems to give the same result: factors n = [m | m <- [1..n `div` 2], mod n m == 0]++

Re: [Haskell-cafe] Zumkeller numbers

2009-12-08 Thread Richard O'Keefe
On Dec 8, 2009, at 8:44 PM, Ketil Malde wrote: "Richard O'Keefe" writes: factors n = [m | m <- [1..n], mod n m == 0] I should remark that I wasn't *trying* to write fast code. I was trying to code as directly as I could, fully expecting to have to rewrite later. I was pleasantly surprised

Re: [Haskell-cafe] Zumkeller numbers

2009-12-08 Thread Daniel Fischer
Am Dienstag 08 Dezember 2009 08:44:52 schrieb Ketil Malde: > "Richard O'Keefe" writes: > > factors n = [m | m <- [1..n], mod n m == 0] > > -- saves about 10% time, seems to give the same result: > factors n = [m | m <- [1..n `div` 2], mod n m == 0]++[n] Even faster (for large enough n): fact

Re: [Haskell-cafe] Zumkeller numbers

2009-12-07 Thread Ketil Malde
"Richard O'Keefe" writes: > factors n = [m | m <- [1..n], mod n m == 0] -- saves about 10% time, seems to give the same result: factors n = [m | m <- [1..n `div` 2], mod n m == 0]++[n] (But checking against primes is even faster, it seems) -k -- If I haven't seen further, it is by standin

Re: [Haskell-cafe] Zumkeller numbers

2009-12-07 Thread Daniel Fischer
Am Dienstag 08 Dezember 2009 01:54:12 schrieb a...@spamcop.net: > G'day all. > > Quoting Richard O'Keefe : > > These lines of Haskell code find the Zumkeller numbers up to 5000 > > in 5 seconds on a 2.2GHz intel Mac. The equivalent in SML took > > 1.1 seconds. Note that this just finds whether a

Re: [Haskell-cafe] Zumkeller numbers

2009-12-07 Thread ajb
G'day all. Quoting Richard O'Keefe : These lines of Haskell code find the Zumkeller numbers up to 5000 in 5 seconds on a 2.2GHz intel Mac. The equivalent in SML took 1.1 seconds. Note that this just finds whether a suitable partition exists; it does not report the partition. This takes 0.1

Re: [Haskell-cafe] Zumkeller numbers

2009-12-07 Thread Henning Thielemann
On Tue, 8 Dec 2009, Richard O'Keefe wrote: is_Zumkeller :: Int -> Bool is_Zumkeller n = let facs = factors n fsum = sum facs in mod fsum 2 == 0 && I see this test is essential. I didn't do it and thus my program did not find that 1800 is not a Zumkeller number within an hour. With

RE: [Haskell-cafe] Zumkeller numbers

2009-12-07 Thread Frank Buss
> From: Richard O'Keefe [mailto:o...@cs.otago.ac.nz] > > These lines of Haskell code find the Zumkeller numbers up to 5000 > in 5 seconds on a 2.2GHz intel Mac. The equivalent in SML took > 1.1 seconds. Note that this just finds whether a suitable > partition exists; it does not report the parti

RE: [Haskell-cafe] Zumkeller numbers

2009-12-07 Thread Frank Buss
> From: daniel.is.fisc...@web.de [mailto:daniel.is.fisc...@web.de] > > Not related to Haskell, but do you think semi-Zumkeller numbers are > > semi-perfect numbers? > > The site you linked to says so. I've not investigated. Peter Luschny posted the link in a discussion in a German newsgroup: h

Re: [Haskell-cafe] Zumkeller numbers

2009-12-07 Thread Richard O'Keefe
On Dec 8, 2009, at 10:33 AM, Frank Buss wrote: Anyone interested in writing some lines of Haskell code for generating the Zumkeller numbers? http://www.luschny.de/math/seq/ZumkellerNumbers.html These lines of Haskell code find the Zumkeller numbers up to 5000 in 5 seconds on a 2.2GHz intel

Re: [Haskell-cafe] Zumkeller numbers

2009-12-07 Thread Daniel Fischer
Am Montag 07 Dezember 2009 22:33:32 schrieb Frank Buss: > Anyone interested in writing some lines of Haskell code for generating the > Zumkeller numbers? > > http://www.luschny.de/math/seq/ZumkellerNumbers.html > > My C/C# solutions looks clumsy (but is fast). I think this can be done much > more e

Re: [Haskell-cafe] Zumkeller numbers

2009-12-07 Thread Henning Thielemann
On Mon, 7 Dec 2009, Frank Buss wrote: Anyone interested in writing some lines of Haskell code for generating the Zumkeller numbers? http://www.luschny.de/math/seq/ZumkellerNumbers.html My C/C# solutions looks clumsy (but is fast). I think this can be done much more elegant in Haskell with l

Re: [Haskell-cafe] Zumkeller numbers

2009-12-07 Thread Joe Fredette
Here's a completely naive implementation, it's slow as cold molasses going uphill during a blizzard, but it doesn't seem to be wrong. I let it run in the interpreter for the last 3 minutes or so and it's reproduced the given list up to 126 (and hasn't crapped out yet). I imagine there's pro