Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: Extract values and multilpicities from list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg64867] Re: Extract values and multilpicities from list
  • From: bghiggins at ucdavis.edu
  • Date: Mon, 6 Mar 2006 05:01:17 -0500 (EST)
  • References: <due96k$ach$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

I think this was asked in the group, but I cannot finsit. Here is one
possibility

lst = Table[Random[Integer, {1, 15}], {1000000}];

Split[Sort[lst]] /. {x_Integer, y___Integer} :> {x, Length[{y}] + 1} //
Timing

{1.07329 Second, {{1, 66636}, {2,
  66837}, {3, 66687}, {4, 66913}, {5, 66604}, {6, 66937}, {7, 66543},
{8,
    66886}, {9, 66375}, {10, 66947}, {11, 66596}, {12, 66634}, {13,
66190}, {
    14, 66490}, {15, 66725}}}

Cheers,

Brian


  • Prev by Date: Compile Fourier
  • Next by Date: Re: Mathematica Link for Excel
  • Previous by thread: Re: Extract values and multilpicities from list
  • Next by thread: Re: Extract values and multilpicities from list