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