Download or view BenfordsLaw.frink in plain text format
// Calculate probability that the nth digit of a number (with certain
// properties, like measurements of physical quantities that range over
// several orders of magnitude) is the digit d.
//
// This is generally known as "Benford's Law".
prob[n,d] :=
{
if n == 1
return log[1+1/d]
sum = 0
for k = 10^(n-2) to 10^(n-1) - 1
sum = sum + log[1 + 1/(10k + d)]
return sum
}
Download or view BenfordsLaw.frink in plain text format
This is a program written in the programming language Frink.
For more information, view the Frink
Documentation or see More Sample Frink Programs.
Alan Eliasen was born 20145 days, 12 hours, 33 minutes ago.