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


import std.stdio, std.algorithm, std.math, std.string, std.range;
 
real entropy(T)(T[] s) pure nothrow
if (__traits(compiles, s.sort())) {
    immutable sLen = s.length;
    return s
           .sort()
           .group
           .map!(g => g[1] / real(sLen))
           .map!(p => -p * p.log2)
           .sum;
}
 
void main() {
    enum uint nMax = 37;
 
    "  N     Length               Entropy Fibword".writeln;
    uint n = 1;
    foreach (s; recurrence!q{a[n - 1] ~ a[n - 2]}("1", "0").take(nMax))
        writefln("%3d %10d %2.19f %s", n++, s.length,
                 s.dup.representation.entropy.abs,
                 s.length < 25 ? s : "<too long>");
}