A187220 Gullwing sequence (see Comments lines for precise definition).
0, 1, 3, 7, 15, 23, 31, 47, 71, 87, 95, 111, 135, 159, 191, 247, 311, 343, 351, 367, 391, 415, 447, 503, 567, 607, 639, 695, 767, 847, 967, 1143, 1303, 1367, 1375, 1391, 1415, 1439, 1471, 1527, 1591, 1631, 1663, 1719, 1791, 1871, 1991, 2167, 2327, 2399, 2431
Offset: 0
Examples
On the infinite square grid we start at stage 0 with no G-toothpicks, so a(0) = 0. At stage 1 we place a G-toothpick: Midpoint : (0,-1) Endpoints: (-1,0) and (1,0) So a(1) = 1. There are two exposed endpoints. At stage 2 we place two G-toothpicks: Midpoint of the left G-toothpick : (-1,0) Endpoints of the left G-toothpick: (-2,1) and (-2,-1) Midpoint of the right G-toothpick : (1,0) Endpoints of the right G-toothpick: (2,1) and (2,-1) So a(2) = 1+2 = 3. There are four exposed endpoints. And so on...
Links
- Iain Fox, Table of n, a(n) for n = 0..10000
- David Applegate, The movie version
- David Applegate, Illustration for a(16) = 311 [Created from the movie version, see previous link]
- David Applegate, Omar E. Pol and N. J. A. Sloane, The Toothpick Sequence and Other Sequences from Cellular Automata, 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.]
- Brady Haran and N. J. A. Sloane, Terrific Toothpick Patterns, Numberphile video (2018).
- Omar E. Pol, Illustration of initial terms
- N. J. A. Sloane, Catalog of Toothpick and Cellular Automata Sequences in the OEIS
Programs
-
Mathematica
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 *)
-
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) a(n) = if(n<2, n, 1 + 2*A139250(n-1)) \\ Iain Fox, Dec 10 2018
-
Python
def msb(n): t=0 while n>>t>0: t+=1 return 2**(t - 1) def a139250(n): k=(2*msb(n)**2 + 1)//3 return 0 if n==0 else k if n==msb(n) else k + 2*a139250(n - msb(n)) + a139250(n - msb(n) + 1) - 1 def a(n): return 0 if n==0 else 1 + 2*a139250(n - 1) print([a(n) for n in range(101)]) # Indranil Ghosh, Jul 01 2017
Formula
a(n) = 1 + 2*A139250(n-1), for n >= 1.
a(n) = 1 + A160164(n-1), for n >= 1. - [Suggested by Omar E. Pol, Mar 13 2011, proved by Nathaniel Johnston, Mar 22 2011]
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.
a(n) = 7 + 8*A153000(n-3), n >= 3. - Omar E. Pol, Feb 16 2013
Comments