Here's a short Perl script to recursively test a directory for its adherence to Benford's Law:
In order to use it, do "perl benford-check.perl" to test the current directory, or "perl benford-check.perl DIRNAME" to test another directory.
The script doesn't cross any mount points.
Here are the results of running this on the root partition of a Linux Mint 16 machine:
% perl bin/benford-check.perl / Device number is 2065 Starts with 1 --> 74328 times (32.46) 2 --> 44696 times (19.52) 3 --> 28772 times (12.57) 4 --> 19124 times ( 8.35) 5 --> 14518 times ( 6.34) 6 --> 12392 times ( 5.41) 7 --> 10512 times ( 4.59) 8 --> 9406 times ( 4.11) 9 --> 9184 times ( 4.01)
Your assignment is to check all of the partitions on any one of the lab machines in 202MCH. Please send me one flat text file called "results.txt" that has a report for each partition on the disk drive, and whether you think the filesizes of the files found on each partition seem to obey Benford's law.
You will to be root to do this, both in running the script and when you go to mount the unmounted partitions on the lab machines. Please always mount these additional partitions read-only.
This is a pass/fail assignment; you either will get full credit or you will get no credit.
Please send your answers to me via email by 11:59pm on Friday, April 29; please indicated if you wish to count this as a make-up assignment or for extra credit in the class.