<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.7600.16671"></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT color=#0000ff size=2
face=Arial></FONT> </DIV><BR>
<BLOCKQUOTE
style="BORDER-LEFT: #0000ff 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px"
dir=ltr>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> Phil Bewig [mailto:pbewig@gmail.com]
<BR><B>Sent:</B> 15 October 2010 15:06<BR><B>To:</B> Jos Koot<BR><B>Cc:</B>
Chris Stephenson; users@racket-lang.org<BR><B>Subject:</B> Re: [racket] a
small programming exercise<BR></FONT><BR></DIV>
<DIV></DIV>Not quite.
<DIV><BR></DIV>
<DIV>Random numbers are uniformly distributed, so the first digits of a set of
random numbers should all appear equally.<SPAN class=911312715-15102010><FONT
color=#0000ff size=2 face=Arial> </FONT></SPAN></DIV></BLOCKQUOTE>
<DIV dir=ltr><FONT face=Arial><FONT size=2><FONT color=#0000ff><SPAN
class=911312715-15102010>This is exactly the samer mistake I
made.</SPAN></FONT></FONT></FONT></DIV>
<DIV dir=ltr><FONT face=Arial><FONT size=2><FONT color=#0000ff><SPAN
class=911312715-15102010></SPAN></FONT></FONT></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial><FONT size=2><FONT color=#0000ff><SPAN
class=911312715-15102010>No, take a uniform distribution of pseudo random
numbers between 1 and 200. Like <FONT color=#000000 size=3
face="Times New Roman">Chris Stephenson wrote, w</FONT>ith base 10 about half of
them to start with 1. I checked this.</SPAN></FONT></FONT></FONT></DIV>
<DIV dir=ltr><FONT face=Arial><FONT size=2><FONT color=#0000ff><SPAN
class=911312715-15102010></SPAN></FONT></FONT></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial><FONT size=2><FONT color=#0000ff><SPAN
class=911312715-15102010>Take a uniform distribution between 1 and 400. With
base 10 I expect and find about one quarter of the numbers to start with 1
and with base 20 I expect and find every digit from 1 to 19 to occur with
about the same frequency.</SPAN></FONT></FONT></FONT></DIV>
<DIV dir=ltr><FONT face=Arial><FONT size=2><FONT color=#0000ff><SPAN
class=911312715-15102010>Jos</SPAN></FONT></FONT></FONT></DIV>
<DIV dir=ltr><FONT face=Arial><FONT size=2><FONT color=#0000ff><SPAN
class=911312715-15102010></SPAN></FONT></FONT></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial><FONT size=2><FONT color=#0000ff><SPAN
class=911312715-15102010></SPAN></FONT></FONT></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial><FONT size=2><FONT color=#0000ff><SPAN
class=911312715-15102010></SPAN></FONT></FONT></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial><FONT size=2><FONT color=#0000ff><SPAN
class=911312715-15102010></SPAN></FONT></FONT></FONT> </DIV>
<BLOCKQUOTE
style="BORDER-LEFT: #0000ff 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px"
dir=ltr>
<DIV><SPAN class=911312715-15102010></SPAN> </DIV>
<DIV><BR></DIV>
<DIV>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.</DIV>
<DIV><BR></DIV>
<DIV>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.</DIV>
<DIV><BR></DIV>
<DIV>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.<BR><BR></DIV>
<DIV>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.</DIV>
<DIV><BR>
<DIV class=gmail_quote>On Fri, Oct 15, 2010 at 6:33 AM, Jos Koot <SPAN
dir=ltr><<A
href="mailto:jos.koot@telefonica.net">jos.koot@telefonica.net</A>></SPAN>
wrote:<BR>
<BLOCKQUOTE
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote>
<DIV class=im><BR><BR>> -----Original Message-----<BR>> From: <A
href="mailto:users-bounces@racket-lang.org">users-bounces@racket-lang.org</A><BR>>
[mailto:<A
href="mailto:users-bounces@racket-lang.org">users-bounces@racket-lang.org</A>]
On Behalf Of Chris Stephenson<BR>> Sent: 15 October 2010 11:13<BR>>
To: <A href="mailto:users@racket-lang.org">users@racket-lang.org</A><BR>>
Subject: Re: [racket] a small programming exercise<BR>><BR></DIV>
<DIV class=im>snip<BR>><BR>> Think about the decimal numbers in the
range 1-200. How many<BR>> start with<BR>> 1?- More than half. The
range 1-1000 is an exception. But<BR><BR></DIV>The exceptions are flat
distributions of natural numbers in a range from 1<BR>to a power of the
base, right?<BR>For example:<BR>(test 1000000 (expt 5 5) 5) -> (250490
249654 249630 250226)<BR>distribution of 1000000 natural numbers in the
range 1 to (expt 5 5) and<BR>base 5.<BR>1000000/4=250000<BR>
<DIV>
<DIV></DIV>
<DIV class=h5><BR>> natural distributions are not uniform over a fixed
range.<BR>> They are bell curves of one sort or another. If you have
a<BR>> natural random distribution there will always be a skew<BR>>
toward the smaller digits. It is quantified as Benford's
law.<BR>><BR>> --<BR>> Chris Stephenson<BR>> <A
href="mailto:cs@cs.bilgi.edu.tr">cs@cs.bilgi.edu.tr</A><BR>>
_________________________________________________<BR>> For
list-related administrative tasks:<BR>> <A
href="http://lists.racket-lang.org/listinfo/users"
target=_blank>http://lists.racket-lang.org/listinfo/users</A><BR><BR><BR>_________________________________________________<BR> For
list-related administrative tasks:<BR> <A
href="http://lists.racket-lang.org/listinfo/users"
target=_blank>http://lists.racket-lang.org/listinfo/users</A><BR></DIV></DIV></BLOCKQUOTE></DIV><BR></DIV></BLOCKQUOTE></BODY></HTML>