Another novice question. I trying to get the factors of a number N. I use q:
to get the prime factors. As many of those as there are, say M, I generate
the 2^M binary numbers using

#: i.(2^M)

For M=3 we therefore have

0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

Now, any given item of this, when used as the left operand to #, with q: N
being the right, gives me a combination of prime factors that I will
multiply with */ to get a possible factor. I'd just finish off with ~. to
clean up the list of factors.

My problem is in taking that list of binary numbers and using each item to #
the prime factors. In the above example the longest copy will result in a
list of shape 3, and so every result item has shape 3.

I had a really ugly work around that replaced all the zeros with one's,
after doing the #, and seeing as how I followed with */ that worked. But I
didn't like it.

Is there a more elegant solution? Or I should say, what might it be? Could
it involve boxes?

Thanks.

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

Reply via email to