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


/*REXX program displays the number of chars in a fibonacci word, and the word's entropy.*/
d= 21;      de= d + 6;      numeric digits de    /*use more precision (the default is 9)*/
parse arg N .                                    /*get optional argument from the C.L.  */
if N==''  | N==","  then N= 42                   /*Not specified?  Then use the default.*/
say center('N', 3)   center("length", de)   center('entropy', de)   center("Fib word", 56)
say copies('─', 3)   copies("─"     , de)   copies('─'      , de)   copies("─"       , 56)
c= 1                                             /*initialize the 1st value for entropy.*/
      do j=1  for N                              /* [↓]  display   N   fibonacci words. */
      if j==2  then c= 0                         /*test for the case of  J  equals  2.  */
      if j==3  then parse value  1 0  with  a b  /*  "   "   "    "   "  "    "     3.  */
      if j>2   then c= b || a                    /*calculate the FIBword  if we need to.*/
      L= length(c)                               /*find the length of the fib─word  C.  */
      if L<56  then Fw= c
               else Fw= '{the word is too wide to display}'
      say right(j, 2)     right( commas(L), de)       '  '       entropy()     "  "     Fw
      a= b;    b= c                              /*define the new values for  A  and  B.*/
      end   /*j*/                                /*display text msg;                    */
exit                                             /*stick a fork in it,  we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
commas: parse arg ?;  do jc=length(?)-3  to 1  by -3; ?=insert(',', ?, jc); end;  return ?
/*──────────────────────────────────────────────────────────────────────────────────────*/
entropy: if L==1  then return left(0, d + 2)     /*handle special case of one character.*/
         !.0= length(space(translate(c,, 1), 0)) /*efficient way to count the  "zeroes".*/
         !.1= L - !.0;                  $= 0     /*define 1st fib─word; initial entropy.*/
                do i=1  for 2;          _= i - 1 /*construct character from the ether.  */
                $= $ - !._ / L * log2(!._ / L)   /*add  (negatively)  the entropies.    */
                end   /*i*/
         if $=1  then return   left(1, d+2)      /*return a left─justified  "1"  (one). */
                      return format($, , d)      /*normalize the sum  (S)  number.      */
/*──────────────────────────────────────────────────────────────────────────────────────*/
log2: procedure; parse arg x 1 xx;  ig=x>1.5;  is=1-2*(ig\==1);  numeric digits 5+digits()
      e=2.71828182845904523536028747135266249775724709369995957496696762772407663035354759
      m=0;  do  while  ig & xx>1.5 | \ig&xx<.5;   _=e;         do j=-1;   iz=xx* _ ** - is
            if j>=0  then if ig & iz<1 | \ig&iz>.5  then leave;  _=_*_; izz=iz;  end /*j*/
            xx=izz;  m=m+is*2**j;  end /*while*/;     x=x* e** -m -1;   z=0;   _=-1;   p=z
                   do k=1;   _=-_*x;   z=z+_/k;   if z=p  then leave;   p=z;    end  /*k*/
            r=z+m;            if arg()==2  then return r;             return r / log2(2,.)