[racket] a small programming exercise

 From: Phil Bewig (pbewig at gmail.com) Date: Fri Oct 15 09:05:35 EDT 2010 Previous message: [racket] a small programming exercise Next message: [racket] a small programming exercise Messages sorted by: [date] [thread] [subject] [author]

```Not quite.

Random numbers are uniformly distributed, so the first digits of a set of
random numbers should all appear equally.

Benford's Law most often applies to sets of naturally-occurring numbers that
are scale-invariant.  Consider the lengths of rivers, as Benford did.  It
doesn't matter whether the rivers are measured in miles or kilometers
(scale-invariant).  The first digits of the lengths of the rivers will
conform to Benford's Law, as long as the set has enough elements.

Auditors use Benford's Law to find anomalous records.  Apply Benford's Law
to a list of the amounts of all checks written by a company in the last
year.  If you see too many checks that start with the digits 7, 8, or 9,
there is a clear indication of fraud.  The embezzler wrote checks that were
slightly less than \$1000, on the theory that small checks would more likely
be ignored.  But instead of writing checks for \$263 or \$347 or \$519, he
wrote checks for \$838 or \$922 to maximize his payout.

There was an external audit of the voting results in last year's Iranian
elections.  The audit clearly showed fraud, as there were far too many
precinct tallies that started with the digits 8 or 9.

There is some considerable theory behind Benford's Law.  Google is your
friend.  Or Shriram is lecturing on Benford's Law today -- perhaps he will
share a reference or three.

On Fri, Oct 15, 2010 at 6:33 AM, Jos Koot <jos.koot at telefonica.net> wrote:

>
>
> > -----Original Message-----
> > From: users-bounces at racket-lang.org
> > [mailto:users-bounces at racket-lang.org] On Behalf Of Chris Stephenson
> > Sent: 15 October 2010 11:13
> > To: users at racket-lang.org
> > Subject: Re: [racket] a small programming exercise
> >
> snip
> >
> > Think about the decimal numbers in the range 1-200. How many
> > 1?- More than half. The range 1-1000 is an exception. But
>
> The exceptions are flat distributions of natural numbers in a range from 1
> to a power of the base, right?
> For example:
> (test 1000000 (expt 5 5) 5) -> (250490 249654 249630 250226)
> distribution of 1000000 natural numbers in the range 1 to (expt 5 5) and
> base 5.
> 1000000/4=250000
>
> > natural distributions are not uniform over a fixed range.
> > They are bell curves of one sort or another. If you have a
> > natural random distribution there will always be a skew
> > toward the smaller digits. It is quantified as Benford's law.
> >
> > --
> > Chris Stephenson
> > cs at cs.bilgi.edu.tr
> > _________________________________________________