MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: All componens different

  • To: mathgroup at smc.vnet.net
  • Subject: [mg111999] Re: All componens different
  • From: "Harvey P. Dale" <hpd1 at nyu.edu>
  • Date: Tue, 24 Aug 2010 06:12:46 -0400 (EDT)

Length[Union[v]]====1

	Best,

	Harvey



-----Original Message-----
From: Dr. Wolfgang Hintze [mailto:weh at snafu.de]
Sent: Monday, August 23, 2010 2:52 AM
To: mathgroup at smc.vnet.net
Subject: [mg111999] [mg111996] All componens different

Given a list v of natural numbers I'm looking for a function d[v_] that
returns True if all components are different and False otherwise.

One solution is

d1[v_] :== ! Or @@ Flatten[Table[v[[i]] ==== v[[k]], {i, 1, Length[v]},
{k, i + 1, Length[v]}]]

Can you find more efficient (and elegant) solutions?

Regards,
Wolfgang



  • Prev by Date: Solve[Function] 2 quick questions
  • Next by Date: Re: All componens different
  • Previous by thread: Re: All componens different
  • Next by thread: Re: All componens different