ÎçÒ¹¸£Àû1000¼¯ºÏ

Letter: Letter

Published 31 July 1999

From Steve Hunt-Anschutz

I suspected that I could test the validity of Benford’s law by examining a
large set of random numbers each chosen from a random range. I reasoned that to
choose a representative random range I needed to select from a log base 10 of
ranges. This would avoid skewing towards larger collections of digits.
Thereafter, a number could be chosen from each range linearly at random. So I
sat at my UNIX terminal and typed the following single line command:

yes | sed `100000q’ | awk `BEGIN{srand();u=6*log(10)}
{printf”%e\n”,rand()*exp(rand()*u)}’ | cut -c1 | sort | uniq-c

This tries 100 000 numbers. The lower range limit is always 0, the upper
between 1 and 1 000 000. And it worked! Now I know why the smaller digits always
go first from the house-numbering section of my local DIY store.

sha@prosumsw.com

Issue no. 2197 published 31 July 1999

Sign up to our weekly newsletter

Receive a weekly dose of discovery in your inbox. We'll also keep you up to date with New Scientist events and special offers.

Sign up
Piano Exit Overlay Banner Mobile Piano Exit Overlay Banner Desktop