Benford's law: Difference between revisions

m
Move GW-BASIC into correct position, marked "needs improvement"
No edit summary
m (Move GW-BASIC into correct position, marked "needs improvement")
Line 31:
* A starting page on Wolfram Mathworld is {{Wolfram|Benfords|Law}}.
<br><br>
 
=={{header|GW-BASIC}}==
[[Benford's law]]
<syntaxhighlight lang="GW-BASIC">
10 DEF FNBENFORD(N)=LOG(1+1/N)/LOG(10)
20 CLS
30 PRINT "One digit Benford's Law"
40 FOR i = 1 TO 9
50 PRINT i,:PRINT USING "##.######";FNBENFORD(i)
60 NEXT i
70 END
</syntaxhighlight>
{{out}}
<pre>
1 0.301030
2 0.176091
3 0.124939
4 0.096910
5 0.079181
6 0.066947
7 0.057992
8 0.051153
9 0.045758
</pre>
 
=={{header|8th}}==
Line 1,576 ⟶ 1,552:
8 0.053000 0.051153
9 0.045000 0.045757</pre>
 
=={{header|GW-BASIC}}==
{{improve|GW-BASIC|Does not show actual vs expected values for Fibonaccis as task specifies.}}
<syntaxhighlight lang="GW-BASIC">
10 DEF FNBENFORD(N)=LOG(1+1/N)/LOG(10)
20 CLS
30 PRINT "One digit Benford's Law"
40 FOR i = 1 TO 9
50 PRINT i,:PRINT USING "##.######";FNBENFORD(i)
60 NEXT i
70 END
</syntaxhighlight>
{{out}}
<pre>
1 0.301030
2 0.176091
3 0.124939
4 0.096910
5 0.079181
6 0.066947
7 0.057992
8 0.051153
9 0.045758
</pre>
 
=={{header|Haskell}}==
<syntaxhighlight lang="haskell">import qualified Data.Map as M
10,333

edits