Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Integer Length Count
Replies: 3   Last Post: Nov 24, 2012 2:41 AM

 Messages: [ Previous | Next ]
 Ray Koopman Posts: 3,383 Registered: 12/7/04
Re: Integer Length Count
Posted: Nov 24, 2012 2:28 AM

On Nov 23, 12:32 am, sylvieho...@comcast.net wrote:
> I use a function in SAS that takes, in my case, a billion different integers of varying length and counts the frequency of the length of each integer by converting the digits in the integers into alpha characters and counting the frequency of the right most position of the alpha character.
>
> I am trying to do more and more routine programming in Mathematica and after poking around in documentation for the past 4 hours have yet to find the parallel function in Mathematica for counting the integer frequency length in a big data set. My family wants me to drop everything and put the Turkey in the oven. My cat Sylvester even fell asleep on his back in front of the refrigerator with his little legs up in the air, so he want miss the transfer of the Turkey from the stove to the refrigerator. OH WELL -- IT'S SHOW TIME!
>
> Meanwhile, let me know any recommendations you have on a Mathematica function that parallels the SAS Function.
>
> Sylvia Hobbs

data = RandomInteger[9999, 100]

{6169, 9014, 239, 4874, 1339, 2885, 2828, 5885, 5372, 2491, 6211,
2833, 257, 5671, 3473, 5014, 2437, 1261, 9269, 9883, 587, 7745,
4909, 9986, 9510, 5161, 5278, 4182, 3251, 6873, 7248, 8240, 5027,
4364, 2660, 4769, 7637, 6913, 9587, 4991, 8116, 4252, 2981, 3840,
7352, 1616, 8446, 7901, 8812, 7688, 9850, 3611, 3359, 392, 8364,
180, 6287, 7749, 2951, 7420, 4604, 5137, 7893, 5008, 8839, 9027,
5122, 8253, 232, 6432, 2753, 4974, 9565, 4648, 1439, 9703, 1823,
2903, 8958, 5337, 5929, 9587, 4154, 4020, 1722, 377, 993, 1153,
3779, 3619, 2619, 1377, 2909, 8666, 4808, 2444, 125, 2867, 7919,
1029}

Sort @ Tally @ IntegerLength @ data

{{3, 9}, {4, 91}}

Date Subject Author
11/23/12 sylviehobbs@comcast.net
11/24/12 daniel.lichtblau0@gmail.com
11/24/12 Ray Koopman