Benford's Law: Additive Sequence

Note: Please adjust width of browser if only one column is visible.
[Click here for another Shiny app on Benford's Law]

Consider a sequence of numbers where we fix the initial two numbers and then the value of each subsequent number is the sum of the previous two. We will call this an additive sequence. When the initial two numbers are both 1 then this yields the famous Fibonacci sequence. If you only consider the first digit of each number in an additive sequence and examine its distribution, is it the case that it closely follows Benford's Law? This app generates an additive sequence, for a given length and initial sequence numbers, and applies a goodness of fit test of the observed frequencies of first digits to Benford's Law









Shiny app by Jimmy Doi
Base R code by Jimmy Doi
Shiny source files: GitHub Gist
First 50 numbers in the sequence (first digit in red ):
    [Fibonacci sequence]
    [Lucas sequence]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
[Sequence has  
  numbers total]

Goodness of Fit Test


                

Benford's Law: Power Sequence

Note: Please adjust width of browser if only one column is visible.
[Click here for another Shiny app on Benford's Law]

Consider a sequence of the form b1, b2, …, b n, where b is called the base. We will call this a power sequence. If you only consider the first digit of each number in a power sequence and examine its distribution, is it the case that it closely follows Benford's Law? This app generates the power sequence, for a given b and n, and applies a goodness of fit test of the observed frequencies of first digits to Benford's Law.








Shiny app by Jimmy Doi
Base R code by Jimmy Doi
Shiny source files: GitHub Gist
First 20 numbers in the sequence (first digit in red ):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
[Sequence has  
  numbers total]

Goodness of Fit Test


                

Generalized Benford's Law: Prime Numbers Sequence

Note: Please adjust width of browser if only one column is visible.
[Click here for another Shiny app on Benford's Law]

Consider the sequence of prime numbers less than or equal to some power of 10. An article from 2009 shows that the distribution of the first digit of these prime numbers is well described by what's known as Generalized Benford's Law (GBL) . This app generates the prime numbers less than or equal to 103, 104, 105, or 106 and applies a goodness of fit test of the observed frequencies of first digits to GBL.

More information on the Generalized Benford's Law can be found in the following journal article:

Luque, B. and Lacasa, L.(2009) 'The first-digit frequencies of prime numbers and Riemann zeta zeros' Proc. R. Soc. A , 465, 2197-2216





Shiny app by Jimmy Doi
Base R code by Jimmy Doi
Shiny source files: GitHub Gist
First 80 numbers in the sequence (first digit in red ):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
[Sequence has  
  prime numbers total]

Goodness of Fit Test