Re: Find common elements in a list of sublists

• To: mathgroup at smc.vnet.net
• Subject: [mg125827] Re: Find common elements in a list of sublists
• From: Dana DeLouis <dana01 at me.com>
• Date: Wed, 4 Apr 2012 04:30:41 -0400 (EDT)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com

```> d={{1, 19}, {1, 23}, {1, 5, 25}, {1, 17}, {1, 11}, {1, 5}}
> How do I find the elements common to all the sublists?

Hi.  If I understand the question correctly, using Apply is what you need:

d={{1,19},{1,23},{1,5,25},{1,17},{1,11},{1,5}};

Intersection@@d
{1}

= = = = = = = = = =
HTH  :>)
Dana DeLouis
Mac & Math 8
= = = = = = = = = =

On Apr 3, 4:44 am, Cisco Lane <travl... at yahoo.com> wrote:
> Suppose I have a list of sublists:
>
> d={{1, 19}, {1, 23}, {1, 5, 25}, {1, 17}, {1, 11}, {1, 5}}
>
> How do I find the elements common to all the sublists?
>
> I can do it using intersection:
>
> Intersection[dx[[1]], dx[[2]], dx[[3]], dx[[4]], dx[[5]], dx[[6]]]
>
> which yields, correctly, {1}, but what if the number of sublists in d is variable?

```

• Prev by Date: Re: Find common elements in a list of sublists
• Next by Date: How to generate ``nice'' algebra output from command-line mathematica?
• Previous by thread: Re: Find common elements in a list of sublists
• Next by thread: Barchart with ChartElements doesn't want to plot negative.