This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A168131 #21 Sep 25 2022 11:28:08 %S A168131 0,0,1,2,1,1,5,7,3,1,4,5,3,7,18,19,7,1,4,5,3,7,17,17,7,6,13,13,13,32, %T A168131 56,47,15,1,4,5,3,7,17,17,7,6,13,13,13,32,55,45,15,6,13,13,13,31,51, %U A168131 41,20,25,39,39,58,120,160,111,31,1,4,5,3,7,17,17,7,6,13,13,13,32,55,45,15,6 %N A168131 Number of squares and rectangles that are created at the n-th stage in the corner toothpick structure (see A152980, A153006). %C A168131 Essentially the first differences of A170926. - _Omar E. Pol_, Feb 16 2013 %H A168131 David Applegate, Omar E. Pol and N. J. A. Sloane, <a href="/A000695/a000695_1.pdf">The Toothpick Sequence and Other Sequences from Cellular Automata</a>, Congressus Numerantium, Vol. 206 (2010), 157-191. [There is a typo in Theorem 6: (13) should read u(n) = 4*3^(wt(n-1)-1) for n >= 2.] %H A168131 N. J. A. Sloane, <a href="/wiki/Catalog_of_Toothpick_and_CA_Sequences_in_OEIS">Catalog of Toothpick and Cellular Automata Sequences in the OEIS</a> %F A168131 See Maple program for recurrence. %e A168131 If written as a triangle: %e A168131 0, %e A168131 0, %e A168131 1,2, %e A168131 1,1,5,7, %e A168131 3,1,4,5,3,7,18,19, %e A168131 7,1,4,5,3,7,17,17,7,6,13,13,13,32,56,47, %e A168131 15,1,4,5,3,7,17,17,7,6,13,13,13,32,55,45,15,6,13,13,13,31,51,41,20,... %e A168131 The rows (omitting the first term) converge to A170929. %p A168131 w := proc(n) option remember; local k,i; %p A168131 if (n=0) then RETURN(0) %p A168131 elif (n <= 3) then RETURN(n-1) %p A168131 else %p A168131 k:=floor(log(n)/log(2)); %p A168131 i:=n-2^k; %p A168131 if (i=0) then RETURN(2^(k-1)-1) %p A168131 elif (i<2^k-2) then RETURN(2*w(i)+w(i+1)); %p A168131 elif (i=2^k-2) then RETURN(2*w(i)+w(i+1)+1); %p A168131 else RETURN(2*w(i)+w(i+1)+2); %p A168131 fi; %p A168131 fi; %p A168131 end; %p A168131 [seq(w(n),n=0..256)]; %t A168131 a[n_] := a[n] = Module[{k, i}, Which[n==0, 0, n <= 3, n-1, True, k = Floor[Log2[n]]; i = n-2^k; Which[i==0, 2^(k-1)-1, i < 2^k-2, 2*a[i]+a[i+1], i==2^k-2, 2*a[i]+a[i+1]+1, True, 2*a[i]+a[i+1]+2]]]; %t A168131 Table[a[n], {n, 0, 81}] (* _Jean-François Alcover_, Sep 25 2022, after Maple code *) %Y A168131 Cf. A152980, A153006, A170926, A160124, A160125, A139250. %K A168131 nonn %O A168131 0,4 %A A168131 _Omar E. Pol_, Jan 18 2010 %E A168131 Edited and extended by _N. J. A. Sloane_, Feb 01 2010