This should work Skip, although I changed your call to q: to work on scalars 
and work with a nested list …


   q: each 1998 2997 3996 4995 5994 6993 7992 8991
┌──────────┬──────────┬────────────┬──────────┬────────────┬──────────┬──────────────┬────────────┐
│2 3 3 3 37│3 3 3 3 37│2 2 3 3 3 37│3 3 3 5 37│2 3 3 3 3 37│3 3 3 7 37│2 2 2 3 
3 3 37│3 3 3 3 3 37│
└──────────┴──────────┴────────────┴──────────┴────────────┴──────────┴──────────────┴────────────┘
   ~. each q: each 1998 2997 3996 4995 5994 6993 7992 8991
┌──────┬────┬──────┬──────┬──────┬──────┬──────┬────┐
│2 3 37│3 37│2 3 37│3 5 37│2 3 37│3 7 37│2 3 37│3 37│
└──────┴────┴──────┴──────┴──────┴──────┴──────┴────┘
   in=:(([ e. ])#[)
   2 3 37 in 3 37
3 37
   in each/ ~. each q: each 1998 2997 3996 4995 5994 6993 7992 8991
┌────┐
│3 37│
└────┘

…/Rob



> On 23 Oct 2018, at 5:31 pm, Skip Cave <[email protected]> wrote:
> 
> Given the integers: 1998 2997 3996 4995 5994 6993 7992 8991
> Find the common prime factors in all of these integers.
> 
> Obviously we can find the prime factors of each of the integers:
> 
> q: 1998 2997 3996 4995 5994 6993 7992 8991
> 
> 2 3 3 3 37 0 0
> 
> 3 3 3 3 37 0 0
> 
> 2 2 3 3 3 37 0
> 
> 3 3 3 5 37 0 0
> 
> 2 3 3 3 3 37 0
> 
> 3 3 3 7 37 0 0
> 
> 2 2 2 3 3 3 37
> 
> 3 3 3 3 3 37 0
> 
> 
> What J expression will find the common factors in all 6 of these integers?
> 
> (the result of the expression should be that there are two common factors -
> 3 & 37)
> 
> Skip
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm

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

Reply via email to