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


$ include "seed7_05.s7i";
  include "float.s7i";
  include "math.s7i";
 
const func float: entropy (in string: stri) is func
  result
    var float: entropy is 0.0;
  local
    var hash [char] integer: count is (hash [char] integer).value;
    var char: ch is ' ';
    var float: p is 0.0;
  begin
    for ch range stri do
      if ch in count then
        incr(count[ch]);
      else
        count @:= [ch] 1;
      end if;
    end for;
    for key ch range count do
      p := flt(count[ch]) / flt(length(stri));
      entropy -:= p * log(p) / log(2.0);
    end for;
  end func ;
 
const func string: fibWord (in integer: number) is func
  result
    var string: fibWord is "1";
  local
    var integer: i is 0;
    var string: a is "1";
    var string: c is "";
  begin
    if number >= 2 then
      fibWord := "0";
      for i range 3 to number do
        c := a;
        a := fibWord;
        fibWord &:= c;
      end for;
    end if;
  end func;
 
const proc: main is func
  local
    var integer: index is 0;
    var string: fibWord is "";
  begin
    for index range 1 to 37 do
      fibWord := fibWord(index);
      writeln(index lpad 2 <& length(fibWord) lpad 10 <& " " <& entropy(fibWord) digits 15);
    end for;
  end func;