On Sat, May 5, 2012 at 4:25 PM, Joe Groff <arc...@gmail.com> wrote: > I was trying to write an array-based implementation of the > Miller-Rabin primality test that worked for both a single candidate > and a list of candidates. (I know that the algorithm should short > circuit, and an array-based implementation does extra unnecessary > work; this was just a learning J exercise.) The obvious (to me) way to > do that was with an operator that could handle both rank0 | rank2 ^ > rank1 and rank1 | rank3 ^ rank2 operations in the natural way while > still using modular exponentiation.
Ok, I think I see -- you want the rank prefixes to match across all three values. Here's how to construct an argument for my verb which I think works for the above two cases: modexp rank0,"0 1 rank2,"0 rank1 modexp rank1,"0 1 rank3,"0 rank2 I hope this helps, -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm