The   Fibonacci Word   may be created in a manner analogous to the   Fibonacci Sequence   as described here:

    Define   F_Word1   as   1
    Define   F_Word2   as   0
    Form     F_Word3   as   F_Word2     concatenated with   F_Word1    i.e.:   01
    Form     F_Wordn   as   F_Wordn-1   concatenated with   F_wordn-2



Task

Perform the above steps for     n = 37.

You may display the first few but not the larger values of   n.

{Doing so will get the task's author into trouble with them what be (again!).} 

Instead, create a table for   F_Words   1   to   37   which shows:

   The number of characters in the word
   The word's Entropy


Related tasks
 
   Fibonacci word/fractal
   Entropy
   Entropy/Narcissist


real
entropy(data b)
{
    integer count, i;
    real ones, zeros;
 
    ones = zeros = 0;
 
    i = -(count = ~b);
    while (i) {
        if (b[i] == '0') {
            zeros += 1;
        } else {
            ones += 1;
        }
 
        i += 1;
    }
 
    return -(ones /= count) * log2(ones) - (zeros /= count) * log2(zeros);
}
 
integer
main(void)
{
    data a, b;
    integer i;
 
    a = "1";
    b = "0";
 
    o_form("%2d %9d /w12p10d10/ ~\n", 1, ~a, 0r, a);
    o_form("%2d %9d /w12p10d10/ ~\n", 2, ~b, 0r, b);
    i = 3;
    while (i <= 37) {
        bu_copy(a, 0, b);
        o_form("%2d %9d /w12p10d10/ ~\n", i, ~a, entropy(a),
               i < 10 ? a.string : "");
        i += 1;
        b.swap(a);
    }
 
    return 0;
}