Submit  All submissions  Best solutions  Back to list 
BENCHI  Chisquare test of Benford distribution 
I'm not a great taleteller. Hence here are no stories about uncovered trickery but only the facts.
You get around 500 integers between 1 and 100000. Check with the Χ^{2} test how well the distribution of their first digits does observe Benford's law.
Input
In the first line one number N, then N lines with one number.
Output
The result of the Χ^{2} test of the Benford distribution with two digits after the decimal point.
Example
Input: 10
45564
2915
1454
14200
19
12943
4375
36588
31858
474
Output: 8.37
Added by:  HWK 
Date:  20110305 
Time limit:  3.200s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: SCM qobi 
hide comments
20110926 14:47:00 Hallvard Norheim Bø
@HWK: I think you need to update your C solution :) 

20110815 11:43:33 HWK
@Daniel Hui: Check the map. ;) 

20110410 17:45:17 HWK
@Daniel Hui: Well done! But you give away two bytes. 

20110329 20:34:50 HWK
Congratulation! With Python I can't beat it but with Perl (99). Perhaps you may try Bash and beat 106 bytes? ;) 

20110329 19:14:13 Hallvard Norheim Bø
131 bytes now. Can you beat it? ;) 

20110328 19:06:47 HWK
@hallvabo: My Python solution before publication requires 139 bytes. Thus you must shorten. ;) Perhaps interesting: http://www.spoj.pl/problems/FIBSUM/ Last edit: 20110328 19:07:33 