%I #35 Sep 08 2022 08:46:07
%S 0,0,4,8,32,120,464,1848,7312,29240,116624,466488,1864592,7458360,
%T 29827984,119311928,477225872,1908903480,7635526544,30542106168,
%U 122168075152,488672300600,1954687804304,7818751217208,31274999276432,125099997105720,500399966053264,2001599864213048
%N The total number of rectangles appearing in the Thue-Morse sequence logical matrices after n stages.
%C a(n) is the total number of non-isolated "1s" (consecutive 1s on 2 rows, 1 column or 1 row, 2 columns) that appear as rectangles in the Thue-Morse logical matrices after n stages. See links for more details.
%H G. C. Greubel, <a href="/A241684/b241684.txt">Table of n, a(n) for n = 0..1000</a>
%H Kival Ngaokrajang, <a href="/A241684/a241684.pdf">Illustration of initial terms</a>
%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Thue%E2%80%93Morse_sequence">Thue-Morse sequence</a>
%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (4,5,-20,-4,16)
%F a(n) = A007590(A005578(n+1)) - (A139598(A000975(n-2)) + A007590(A000975(n-1))).
%F G.f.: -4*x^2*(8*x^3-5*x^2-2*x+1) / ((x-1)*(x+1)*(2*x-1)*(2*x+1)*(4*x-1)). - _Colin Barker_, Apr 27 2014
%F a(n) = (8 + 3*2^n + 2*4^n + (-1)^n*(24 - 2^n))/18, n>0. - _R. J. Mathar_, May 04 2014
%t CoefficientList[Series[-4*x^2*(8*x^3 - 5*x^2 - 2*x + 1)/((x - 1)*(x + 1)*(2*x - 1)*(2*x + 1)*(4*x - 1)), {x, 0, 50}], x] (* _G. C. Greubel_, Sep 28 2017 *)
%o (Small Basic)
%o a[0] = 0
%o a[1] = 0
%o b = 1
%o For n = 0 To 20
%o If Math.Remainder(n+2,2) = 0 Then
%o a[n+2] = 2*(a[n+1]*2-(4*b-4)) + 4*b
%o b =b*4 - 2
%o Else
%o a[n+2] = a[n+1]*4 - 8
%o EndIf
%o TextWindow.Write(a[n]+", ")
%o EndFor
%o (PARI) x='x+O('x^50); concat([0,0], Vec(-4*x^2*(8*x^3-5*x^2-2*x+1)/((x-1)*(x+1)*(2*x-1)*(2*x+1)*(4*x-1)))) \\ _G. C. Greubel_, Sep 28 2017
%o (Magma) [(8+3*2^n+2*4^n+(-1)^n*(24-2^n))/18: n in [0..30]]; // _Vincenzo Librandi_, Sep 29 2017
%Y Cf. A010060.
%K nonn,easy
%O 0,3
%A _Kival Ngaokrajang_, Apr 27 2014
%E Terms a(21) onward added by _G. C. Greubel_, Sep 28 2017