[Jprogramming] Rosetta code: hamming numbers
Roger Hui
rhui000 at shaw.ca
Wed Jan 6 01:58:02 HKT 2010
Perhaps you can use some variation of hf^:n 1x where
hf=: ~.@(/:~)@,@(1 2 3 5 */ ])
----- Original Message -----
From: Aai <bradypus at xs4all.nl>
Date: Tuesday, January 5, 2010 9:19
Subject: [Jprogramming] Rosetta code: hamming numbers
To: Programming forum <programming at jsoftware.com>
> J-ers and RC-ers,
>
> I entered a solution for this task:
> http://rosettacode.org/wiki/Hamming_numbers .
>
> hamming =: {. (/:~@~.@] , 2 3 5 * {)/ @ (1x ,~ i. at -)
>
>
> However the problem is (which I didn't realize while entering my
> solution) producing the millionth hamming number. So if anyone
> has a
> better idea on this, go ahead. Of course it's also a challenge
> to come
> up with a very J-ish solution for this problem.
>
> R.E.Boss perhaps? I used your solution HN00 and it produced the answer
> in ca. 47 sec on my computer.
More information about the Programming
mailing list