I'm a newbie here too… I tried and designed a 2-lines mini-program.
* one line for variable definition, using =:, <:, + and i.
* the other for computation, using =, +, (, ) and /
The key is / used as Insert *and* Table.
PS: Is the expected solution 190?
On 05/24/2013 06:28 PM, Robert Herman wrote:
> Here is the problem: Given three sides, x, y and
> z, where x<y<z and a perimeter of 57, with z < 1/2 of the perimeter, how
> many triangles can you make that fit that criteria. Somebody created a perl
> script with nested loops:
>
> for $x (1..57/2) {
> for $y ($x+1..57/2) {
> for $z ($y+1..57/2) {
> if ($x + $y + $z eq 57) {
> ++$count;
> print "$count: $x $y $z\n";
> }}}}
> print "Total: $count";
>
>
> I thought I could start to do it this way in J:
>
> x =. i..26
> y =. >:x
> z =. >:y
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm