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 A153003 #37 Feb 24 2021 02:48:18 %S A153003 0,1,4,7,10,16,25,31,34,40,49,58,70,91,115,127,130,136,145,154,166, %T A153003 187,211,226,238,259,286,316,361,427,487,511,514,520,529,538,550,571, %U A153003 595,610,622,643,670,700,745,811,871,898,910,931 %N A153003 Toothpick sequence in the first three quadrants. %C A153003 From _Omar E. Pol_, Oct 01 2011: (Start) %C A153003 On the infinite square grid, consider only the first three quadrants and count only the toothpicks of length 2. %C A153003 At stage 0, we start from a vertical half toothpick at [(0,0),(0,1)]. This half toothpick represents one of the two components of the first toothpick placed in the toothpick structure of A139250, so a(0) = 0. %C A153003 At stage 1, we place an orthogonal toothpick of length 2 centered at the end, so a(1) = 1. Also we place half toothpick at [(0,-1),(1,-1)]. This last half toothpick represents one of the two components of the third toothpick placed in the toothpick structure of A139250. %C A153003 At stage 2, we place three toothpicks, so a(2) = 1+3 = 4. %C A153003 In each subsequent stage, for every exposed toothpick end, place an orthogonal toothpick centered at that end. %C A153003 The sequence gives the number of toothpicks after n stages. A153004 (the first differences) gives the number of toothpicks added to the structure at n-th stage. %C A153003 Note that this sequence is different from the toothpick "corner" sequence A153006. For more information see A139250. (End) %H A153003 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 A153003 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> %H A153003 <a href="/index/To#toothpick">Index entries for sequences related to toothpick sequences</a> %F A153003 a(n) = (A139250(n+1)-3)*3/4 + 1, if n >= 1. %F A153003 From _Omar E. Pol_, Oct 01 2011: (Start) %F A153003 a(n) = A139250(n+1) - A152998(n) + A153000(n-1) - 1, if n >= 1. %F A153003 a(n) = A139250(n+1) - A153000(n-1) - 2, if n >= 1. %F A153003 a(n) = A152998(n) + A153000(n-1), if n >= 1. %F A153003 (End) %t A153003 A139250[n_] := A139250[n] = Module[{m, k}, If[n == 0, Return[0]]; m = 2^(Length[IntegerDigits[n, 2]] - 1); k = (2 m^2 + 1)/3; If[n == m, k, k + 2 A139250[n - m] + A139250[n - m + 1] - 1]]; %t A153003 a[n_] := If[n == 0, 0, (3/4)(A139250[n + 1] - 3) + 1]; %t A153003 a /@ Range[0, 49] (* _Jean-François Alcover_, Apr 06 2020 *) %o A153003 (Python) %o A153003 def msb(n): %o A153003 t=0 %o A153003 while n>>t>0: t+=1 %o A153003 return 2**(t - 1) %o A153003 def a139250(n): %o A153003 k=(2*msb(n)**2 + 1)/3 %o A153003 return 0 if n==0 else k if n==msb(n) else k + 2*a139250(n - msb(n)) + a139250(n - msb(n) + 1) - 1 %o A153003 def a(n): return 0 if n==0 else (a139250(n + 1) - 3)*3/4 + 1 %o A153003 [a(n) for n in range(51)] # _Indranil Ghosh_, Jul 01 2017 %Y A153003 Cf. A139250, A139251, A152968, A152978, A152998, A153000, A153004. %K A153003 nonn %O A153003 0,3 %A A153003 _Omar E. Pol_, Jan 02 2009