On 7/14/07, Arie Groeneveld <[EMAIL PROTECTED]> wrote:
No doubt there's a more J-ish way in doing this,

Here's one way of generating the unique pythogorean triples
with hypotenuse less than 100 (ignoring prime multiples of triples):

pgen=:  (i.0 2)"_`(gen@<:,(,.i.))@.(0&<)
psel=: (,.-/&.:*:@|:)@(#~ (=<.)@(-/&.:*:)@|:)
ptrp=: ~.@:(/:~"1)@(%+./"1)@psel@(pgen&.<:)

  ptrp 100
3  4  5
5 12 13
8 15 17
7 24 25
20 21 29
12 35 37
9 40 41
28 45 53
11 60 61
16 63 65
33 56 65
48 55 73
13 84 85
36 77 85
39 80 89
65 72 97

If you are looking for something different, perhaps you could
describe it a bit more?

Thanks,

--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to