Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #12453

Re: Integer Length Count

From James Stein <mathgroup@stein.org>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Integer Length Count
Date 2012-11-24 07:41 +0000
Message-ID <k8ptmj$j38$1@smc.vnet.net> (permalink)
References <20121123082854.1CF386932@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


I think this meets your problem description:

    Tally [ integerList // IntegerLength ]

Example:

   f [ n_ ] := Module [ {maxInt, nInts, list },
   maxInt = 1000000000;
   nInts = n;
   list = RandomInteger [ { 0, maxInt }, nInts ] ;
   Tally [ list // IntegerLength ] // Sort  // AbsoluteTiming
   ] ;
   f[10]

The good news: f [ one hundred million ] runs in under 7 seconds (on
my computer).
The bad news:   f [ one billion ] hangs (or runs inordinately long ).

HTH


On Fri, Nov 23, 2012 at 12:28 AM, <sylviehobbs@comcast.net> wrote:
>
>
> I use a function in SAS that takes, in my case, a billion different integ=
ers of varying length and counts the frequency of the length of each intege=
r by converting the digits in the integers into alpha characters and counti=
ng the frequency of the right most position of the alpha character.
>
>
>
> I am trying to do more and more routine programming in Mathematica and af=
ter poking around in documentation for the past 4 hours have yet to find th=
e parallel function in Mathematica for counting the integer frequency lengt=
h in a big data set. My family wants me to drop everything and put the Turk=
ey in the oven. My cat Sylvester even fell asleep on his back in front of t=
he refrigerator with his little legs up in the air, so he want miss the tra=
nsfer of the Turkey from the stove to the refrigerator. OH WELL -- IT'S SHO=
W TIME!
>
>
>
> Meanwhile, let me know any recommendations you have on a Mathematica func=
tion that parallels the SAS Function.
>
>
>
> Sylvia Hobbs
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Integer Length Count James Stein <mathgroup@stein.org> - 2012-11-24 07:41 +0000

csiph-web