%I #130 Feb 22 2023 18:27:13
%S 0,1,3,7,15,23,31,47,71,87,95,111,135,159,191,247,311,343,351,367,391,
%T 415,447,503,567,607,639,695,767,847,967,1143,1303,1367,1375,1391,
%U 1415,1439,1471,1527,1591,1631,1663,1719,1791,1871,1991,2167,2327,2399,2431
%N Gullwing sequence (see Comments lines for precise definition).
%C The Gullwing (or G-toothpick) sequence is a special type of toothpick sequence. It appears that this is a superstructure of A139250.
%C We define a "G-toothpick" to consist of two arcs of length Pi/2 forming a "gullwing" whose total length is equal to Pi = 3.141592...
%C A gullwing-shaped toothpick or G-toothpick or simply "gull" is formed by two Q-toothpicks (see A187210).
%C A G-toothpick has a midpoint and two endpoints. An endpoint is said to be "exposed" if it is not the midpoint or endpoint of any other G-toothpick.
%C The sequence gives the number of G-toothpicks in the structure after n stages. A187221 (the first differences) gives the number of G-toothpicks added at n-th stage.
%C a(n) is also the diameter of a circle whose circumference equals the total length of all gulls in the gullwing structure after n stages.
%C It appears that the gullwing pattern has a recursive, fractal-like structure. The animation shows the fractal-like behavior.
%C Note that the structure contains many different types of geometrical figures, for example: circles, hearts, etc. All figures are formed by arcs.
%C It appears that there are infinitely many types of circular shapes, which are related to the rectangles of the toothpick structure of A139250.
%C It also appears that the structure contains a nice pattern formed by distinct modular substructures: one central cross surrounded by several asymmetrical crosses (or "hidden crosses") of distinct sizes, and also several "nuclei" of crosses. This pattern is essentially similar to the crosses of A139250 but here the structure is harder to see. For example, consider the nucleus of a cross; in the toothpick structure a nucleus is formed by two squares and two rectangles but here a nucleus is formed by two circles and two hearts.
%C It appears furthermore that this structure has connections with the square-cross fractal and with the T-square fractal, just as in the case of the toothpick structure of A139250.
%C For more information see A139250 and A187210.
%C It appears this is also the connection between A147562 (the Ulam-Warburton cellular automaton) and the toothpick sequence A139250. The behavior of the function is similar to A147562 but here the structure is more complex. (see Plot 2 button: A147562 vs A187220). - _Omar E. Pol_, Mar 11 2011, Mar 13 2011
%C From _Omar E. Pol_, Mar 25 2011: (Start)
%C If we remove the first gull of the structure so we can see that there is a correspondence between the gullwing structure and the I-toothpick structure of A139250, for example: a pair of opposite gulls in horizontal position in the gullwing structure is equivalent to a vertical I-toothpick with length 4 in the I-toothpick structure, such that the midpoint of each horizontal gull coincides with the midpoint of each vertical toothpick of the I-toothpick. See A160164.
%C Also, B-toothpick sequence. We define a "B-toothpick" to consist of four arcs of length Pi/2 forming a "bell" similar to the Gauss function. A Bell-shaped toothpick or B-toothpick or simply "bell" is formed by four Q-toothpicks (see A187210). A B-toothpick has length 2*Pi. The sequence gives the number of B-toothpicks in the structure after n stages.
%C Also, if we remove the first bell of the structure, we can find a correspondence between this structure and the I-toothpick structure of A139250. In this case, for example, a pair of opposite bells in horizontal position is equivalent to a vertical I-toothpick with length 8 in the I-toothpick structure, such that the midpoint of each horizontal bell coincides with the midpoint of each vertical toothpick of the I-toothpick. See A160164.
%C Also, for this sequence there is a third structure formed by isosceles right triangles since gulls or bells can be replaced by these triangles.
%C Note that the size of the gulls, bells and triangles can be adjusted such that two or three of these structures can be overlaid.
%C (End)
%C Also, it appears that if we let k=floor(log_2(n)), then for n >= 1, a(2^k) = (4^(k+1) + 5)/3 - 2^(k+1). Otherwise, a(n)=(4^(k+1) + 5)/3 + 8*A153006(n-1-2^k). - _Christopher Hohl_, Dec 19 2018
%H Iain Fox, <a href="/A187220/b187220.txt">Table of n, a(n) for n = 0..10000</a>
%H David Applegate, <a href="/A139250/a139250.anim.html">The movie version</a>
%H David Applegate, <a href="/A187220/a187220.pdf">Illustration for a(16) = 311</a> [Created from the movie version, see previous link]
%H 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 Brady Haran and N. J. A. Sloane, <a href="https://www.youtube.com/watch?v=_UtCli1SgjI">Terrific Toothpick Patterns</a>, Numberphile video (2018).
%H Omar E. Pol, <a href="http://www.polprimos.com/imagenespub/poltp050.jpg">Illustration of initial terms</a>
%H 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 a(n) = 1 + 2*A139250(n-1), for n >= 1.
%F a(n) = 1 + A160164(n-1), for n >= 1. - [Suggested by _Omar E. Pol_, Mar 13 2011, proved by _Nathaniel Johnston_, Mar 22 2011]
%F The formula involving A160164 can be seen by identifying a Gullwing in the n-th generation (n >= 2) with midpoint at (x,y) and endpoints at (x-1,y+1) and (x+1,y+1) with a toothpick in the (n-1)st generation with endpoints at (x,y-1) and (x,y+1) -- this toothpick from (x,y-1) to (x,y+1) should be considered as having length ONE (i.e., it is HALF of an I-toothpick). The formula involving A139250 follows as a result of the relationship between A139250 and A160164.
%F a(n) = A147614(n-1) + A160124(n-1), n >= 2. - _Omar E. Pol_, Feb 15 2013
%F a(n) = 7 + 8*A153000(n-3), n >= 3. - _Omar E. Pol_, Feb 16 2013
%e On the infinite square grid we start at stage 0 with no G-toothpicks, so a(0) = 0.
%e At stage 1 we place a G-toothpick:
%e Midpoint : (0,-1)
%e Endpoints: (-1,0) and (1,0)
%e So a(1) = 1. There are two exposed endpoints.
%e At stage 2 we place two G-toothpicks:
%e Midpoint of the left G-toothpick : (-1,0)
%e Endpoints of the left G-toothpick: (-2,1) and (-2,-1)
%e Midpoint of the right G-toothpick : (1,0)
%e Endpoints of the right G-toothpick: (2,1) and (2,-1)
%e So a(2) = 1+2 = 3. There are four exposed endpoints.
%e And so on...
%t Join[{0, 1}, Rest[CoefficientList[Series[(2 x / ((1 - x) (1 + 2 x))) (1+2 x Product[1 + x^(2^k - 1) + 2 x^(2^k), {k, 0, 20}]), {x, 0, 53}], x] + 1 ]] (* _Vincenzo Librandi_, Jul 02 2017 *)
%o (Python)
%o def msb(n):
%o t=0
%o while n>>t>0: t+=1
%o return 2**(t - 1)
%o def a139250(n):
%o k=(2*msb(n)**2 + 1)//3
%o 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 def a(n): return 0 if n==0 else 1 + 2*a139250(n - 1)
%o print([a(n) for n in range(101)]) # _Indranil Ghosh_, Jul 01 2017
%o (PARI) A139250(n) = my(msb(m) = 2^(#binary(m)-1), k = (2*msb(n)^2 + 1) / 3); if(n==msb(n), k , k + 2*A139250(n-msb(n)) + A139250(n - msb(n) + 1) - 1)
%o a(n) = if(n<2, n, 1 + 2*A139250(n-1)) \\ _Iain Fox_, Dec 10 2018
%Y Cf. A002450, A139250, A147562, A160164, A187210, A187221, A187222.
%K nonn,easy
%O 0,3
%A _Omar E. Pol_, Mar 07 2011