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


with javascript_semantics
function entropy(sequence s)
    sequence symbols = unique(s),
             counts = repeat(0,length(symbols))
    for i=1 to length(s) do
        integer k = find(s[i],symbols)
        counts[k] += 1
    end for
    atom H = 0
    for i=1 to length(counts) do
        atom ci = counts[i]/length(s)
        H -= ci*log2(ci)
    end for
    return H
end function
 
sequence F_words = {"1","0"}
for i=3 to 37 do
    F_words = append(F_words,F_words[i-1]&F_words[i-2])
end for
 
for i=1 to length(F_words) do
    string fi = F_words[i]
    printf(1,"%2d: length %9d, entropy %f %s\n",
             {i,length(fi),entropy(fi),iff(i<10?fi,"...")})
end for
