From: brien colwell on
I'd start with something simple like

Cases[Tally[list], {a_, 1} :> a]








On Sun, Jan 10, 2010 at 3:28 AM, George <gtatishvili(a)gmail.com> wrote:

> Hi,
>
> I have a very big list of elements and I need Mathematica to give me
> only those elements which occure only once...
>
> Could anybody advise me please how to write the code for that?
>
> Thks much
> George
>
>

From: Albert Retey on
Hi,
>
> I have a very big list of elements and I need Mathematica to give me
> only those elements which occure only once...
>
> Could anybody advise me please how to write the code for that?
>
If you use version 6 or 7, maybe like this?

list = RandomInteger[1000, 1000];

Cases[Tally[list], {x_, 1} :> x]

hth,

albert

From: Harvey P. Dale on
Try this:

Select[BinLists[{yourlist}],Length[#]==1&]

Best,

Harvey

-----Original Message-----
From: George [mailto:gtatishvili(a)gmail.com]
Sent: Sunday, January 10, 2010 3:29 AM
Subject: Occurrences in Mathematica

Hi,

I have a very big list of elements and I need Mathematica to give me
only those elements which occure only once...

Could anybody advise me please how to write the code for that?

Thks much
George


From: Ray Koopman on
On Jan 10, 12:28 am, George <gtatishv...(a)gmail.com> wrote:
> Hi,
>
> I have a very big list of elements and I need Mathematica to give me
> only those elements which occure only once...
>
> Could anybody advise me please how to write the code for that?
>
> Thks much
> George

It takes longer for Cases to process the Tally result
than it takes Tally to generate it. Pick is faster.

In[1]:= Timing(a)Length[a = RandomInteger[999999,1*^6]]
Out[1]= {0.05,1000000}

In[2]:= Timing(a)Length[b = Tally@a]
Out[2]= {1.59,631912}

In[3]:= Timing(a)Length[c = Cases[b,{x_,1}:>x]]
Out[3]= {1.73,367228}

In[4]:= Timing(a)Length[d = Pick[Sequence@@Transpose@b,1]]
Out[4]= {0.5,367228}

In[5]:= c === d
Out[5]= True