A139250 Toothpick sequence (see Comments lines for definition).
0, 1, 3, 7, 11, 15, 23, 35, 43, 47, 55, 67, 79, 95, 123, 155, 171, 175, 183, 195, 207, 223, 251, 283, 303, 319, 347, 383, 423, 483, 571, 651, 683, 687, 695, 707, 719, 735, 763, 795, 815, 831, 859, 895, 935, 995, 1083, 1163, 1199, 1215, 1243, 1279, 1319, 1379
Offset: 0
Examples
a(10^10) = 52010594272060810683. - _David A. Corneth_, Mar 26 2015
References
- D. 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
- L. D. Pryor, The Inheritance of Inflorescence Characters in Eucalyptus, Proceedings of the Linnean Society of New South Wales, V. 79, (1954), p. 81, 83.
- Richard P. Stanley, Enumerative Combinatorics, volume 1, second edition, chapter 1, exercise 95, figure 1.28, Cambridge University Press (2012), p. 120, 166.
Links
- N. J. A. Sloane, Table of n, a(n) for n = 0..65535
- AlgoMotion, Toothpick Sequence Visualized with Circle of Fifths Harmony | 256 Steps, Youtube video (2024).
- David Applegate, The movie version
- David Applegate, Animation of first 32 stages
- David Applegate, Animation of first 64 stages
- David Applegate, Animation of first 128 stages
- David Applegate, Animation of first 256 stages
- David Applegate, C++ program to generate these animations - creates postscript for a specific n
- David Applegate, Generates many postscripts, converts them to gifs, and glues the gifs together into an animation
- David Applegate, Generates b-files for A139250, A139251, A147614
- David Applegate, The b-files for A139250, A139251, A147614 side-by-side
- David Applegate, A three-state CA for the toothpick structure
- 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.], which is also available at arXiv:1004.3036v2
- Joe Champion, Ultimate toothpick pattern, Photo 1, Photo 2, Photo 3, Photo 4, Boise Math Circles, Boise State University. [Links updated by _P. Michael Hutchins_, Mar 03 2018]
- Barry Cipra, What comes next?, Science (AAAS) 327: 943.
- Steven R. Finch, Toothpicks and Live Cells, July 21, 2015. [Cached copy, with permission of the author]
- Ulrich Gehmann, Martin Reiche, World mountain machine, Berlin, (2014), first edition, p. 205, 238, 253.
- Mats Granvik, Additional illustration: Number blocks where each number tells how many times a point on the square grid is crossed or connected to by a toothpick, Jun 21 2009.
- Gordon Hamilton, Three integer sequences from recreational mathematics, Video (2013?).
- J. K. Hamilton, I. R. Hooper, and C. R. Lawrence, Exploring microwave absorption by non-periodic metasurfaces, Advanced Electromagnetics, 10(3), 1-6 (2021).
- M. F. Hasler, Illustration of initial terms
- M. F. Hasler, Illustrations (Three slides)
- Brian Hayes, Joshua Trees and Toothpicks
- Brian Hayes, Idealized Joshua tree, a figure from "Joshua Trees and Toothpicks" (see preceding link)
- Brian Hayes, The Toothpick Sequence - Bit-Player
- Benoit Jubin, Illustration of initial terms
- Mathemaesthetics, 2'796'203 Toothpicks, 2'048 Generations, Youtube video (2021).
- Ayliean McDonald, Toothpick fractal and breaking rules, Youtube video (2021)
- Chris Moore, Gallery, see the section on David Griffeath's Cellular Automata.
- Omar E. Pol, Illustration of initial terms
- Omar E. Pol, Illustration of initial terms using "gulls" (or G-toothpicks)
- Omar E. Pol, Illustration of initial terms using quarter-circles (or Q-toothpicks)
- Omar E. Pol, Illustration of the toothpick structure (after 23 steps)
- Omar E. Pol, Illustration of patterns in the toothpick structure (after 32 steps)
- Omar E. Pol, Illustration of patterns in the toothpick structure (after 32 steps) [Cached copy, with permission]
- Omar E. Pol, Illustration of initial terms of A139250, A160120, A147562 (Overlapping figures)
- Omar E. Pol, Illustration of initial terms of A160120, A161206, A161328, A161330 (triangular grid and toothpick structure)
- Omar E. Pol, Illustration of the substructures in the first quadrant (As pieces of a puzzle), after 32 stages
- Omar E. Pol, Illustration of the potential growth direction of the arms of the substructures, after 32 stages
- Olbaid Fractalium, Toothpick sequence Part 1, (Watch from minute 0:00 until 3:13), Youtube video (2023).
- Programing Puzzles & Code Golf Stack Exchange, Generate toothpick sequence
- L. D. Pryor, Illustration of initial terms (Fig. 2a)
- L. D. Pryor, The Inheritance of Inflorescence Characters in Eucalyptus, Proceedings of the Linnean Society of New South Wales, V. 79, (1954), p. 79-89.
- E. Rowland, Toothpick sequence from cellular automaton on square grid
- E. Rowland, Initial stages of toothpick sequence from cellular automaton on square grid (includes Mathematica code)
- K. Ryde, ToothpickTree.
- Daniel Shiffman, Coding Challenge #126: Toothpicks, The Coding Train video (2018)
- N. J. A. Sloane, Catalog of Toothpick and Cellular Automata Sequences in the OEIS
- N. J. A. Sloane and Brady Haran, Terrific Toothpick Patterns, Numberphile video (2018)
- Alex van den Brandhof and Paul Levrie, Tandenstokerrij, Pythagoras, Wiskundetijdschrift voor Jongeren, 55ste Jaargang, Nummer 6, Juni 2016, (see the cover, pages 1, 18, 19 and the back cover).
- Lu Wang, Minecraft Toothpicks N = 53
- Wikipedia, Cairo pentagonal tiling
- Wikipedia, H tree
- Wikipedia, Toothpick sequence
- Wikipedia, T-square (fractal)
- Index entries for sequences related to toothpick sequences
- Index entries for sequences related to cellular automata
Crossrefs
Cf. A000079, A002450, A006519, A139251, A139252, A139253, A147614, A139560, A152968, A152978, A152980, A152998, A153000, A153001, A153003, A153004, A153006, A153007, A000217, A007583, A007683, A000396, A000225, A000668, A006516, A006095, A019988, A160570, A160552, A000969, A001316, A151566, A160406, A160408, A160702, A078008, A151548, A001045, A147562, A160124, A160120, A160160, A160170, A160172, A161206, A161328, A161330, A171977, A194810, A296510, A296612, A299476, A299478, A323650, A336532.
Programs
-
Maple
G := (x/((1-x)*(1+2*x))) * (1 + 2*x*mul(1+x^(2^k-1)+2*x^(2^k),k=0..20)); # N. J. A. Sloane, May 20 2009, Jun 05 2009 # From N. J. A. Sloane, Dec 25 2009: A139250 is T, A139251 is a. a:=[0,1,2,4]; T:=[0,1,3,7]; M:=10; for k from 1 to M do a:=[op(a),2^(k+1)]; T:=[op(T),T[nops(T)]+a[nops(a)]]; for j from 1 to 2^(k+1)-1 do a:=[op(a), 2*a[j+1]+a[j+2]]; T:=[op(T),T[nops(T)]+a[nops(a)]]; od: od: a; T;
-
Mathematica
CoefficientList[ Series[ (x/((1 - x)*(1 + 2x))) (1 + 2x*Product[1 + x^(2^k - 1) + 2*x^(2^k), {k, 0, 20}]), {x, 0, 53}], x] (* Robert G. Wilson v, Dec 06 2010 *) a[0] = 0; a[n_] := a[n] = Module[{m, k}, m = 2^(Length[IntegerDigits[n, 2]] - 1); k = (2m^2+1)/3; If[n == m, k, k + 2 a[n - m] + a[n - m + 1] - 1]]; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Oct 06 2018, after David A. Corneth *)
-
PARI
A139250(n,print_all=0)={my(p=[], /* set of "used" points. Points are written as complex numbers, c=x+iy. Toothpicks are of length 2 */ ee=[[0,1]], /* list of (exposed) endpoints. Exposed endpoints are listed as [c,d] where c=x+iy is the position of the endpoint, and d (unimodular) is the direction */ c,d,ne, cnt=1); print_all && print1("0,1"); n<2 && return(n); for(i=2,n, p=setunion(p, Set(Mat(ee~)[,1])); /* add endpoints (discard directions) from last move to "used" points */ ne=[]; /* new (exposed) endpoints */ for( k=1, #ee, /* add endpoints of new toothpicks if not among the used points */ setsearch(p, c=ee[k][1]+d=ee[k][2]*I) || ne=setunion(ne,Set([[c,d]])); setsearch(p, c-2*d) || ne=setunion(ne,Set([[c-2*d,-d]])); ); /* using Set() we have the points sorted, so it's easy to remove those which finally are not exposed because they touch a new toothpick */ forstep( k=#ee=eval(ne), 2, -1, ee[k][1]==ee[k-1][1] && k-- && ee=vecextract(ee,Str("^"k"..",k+1))); cnt+=#ee; /* each exposed endpoint will give a new toothpick */ print_all && print1(","cnt));cnt} \\ M. F. Hasler, Apr 14 2009
-
PARI
\\works for n > 0 a(n) = {my(k = (2*msb(n)^2 + 1) / 3); if(n==msb(n),k , k + 2*a(n-msb(n)) + a(n - msb(n) + 1) - 1)} msb(n)=my(t=0);while(n>>t>0,t++);2^(t-1)\\ David A. Corneth, Mar 26 2015
-
Python
def msb(n): t = 0 while n>>t > 0: t += 1 return 2**(t - 1) def a(n): k = (2 * msb(n)**2 + 1) / 3 return 0 if n == 0 else k if n == msb(n) else k + 2*a(n - msb(n)) + a(n - msb(n) + 1) - 1 [a(n) for n in range(101)] # Indranil Ghosh, Jul 01 2017, after David A. Corneth's PARI script
Formula
a(2^k) = A007583(k), if k >= 0.
a(2^k-1) = A006095(k+1), if k >= 1.
G.f.: (x/((1-x)*(1+2*x))) * (1 + 2*x*Product_{k>=0} (1 + x^(2^k-1) + 2*x^(2^k))). - N. J. A. Sloane, May 20 2009, Jun 05 2009
One can show that lim sup a(n)/n^2 = 2/3, and it appears that lim inf a(n)/n^2 is 0.451... - Benoit Jubin, Apr 15 2009 and Jan 29 2010, N. J. A. Sloane, Jan 29 2010
Observation: a(n) == 3 (mod 4) for n >= 2. - Jaume Oliver Lafont, Feb 05 2009
a(2^k-1) = A000969(2^k-2), if k >= 1. - Omar E. Pol, Feb 13 2010
It appears that a(n) = (A187220(n+1) - 1)/2. - Omar E. Pol, Mar 08 2011
a(n) = 4*A153000(n-2) + 3, if n >= 2. - Omar E. Pol, Oct 01 2011
Let n = msb(n) + j where msb(n) = A053644(n) and let a(0) = 0. Then a(n) = (2 * msb(n)^2 + 1)/3 + 2 * a(j) + a(j+1) - 1. - David A. Corneth, Mar 26 2015
It appears that a(n) = (A169707(n) - 1)/4 + (A169707(n+1) - 1)/4, n >= 1. - Omar E. Pol, Jul 24 2015
Extensions
Verified and extended, a(49)-a(53), using the given PARI code by M. F. Hasler, Apr 14 2009
Edited by N. J. A. Sloane, Apr 29 2009, incorporating comments from Omar E. Pol, M. F. Hasler, Rob Pratt, Jaume Oliver Lafont, Franklin T. Adams-Watters, R. J. Mathar, David W. Wilson, David Applegate, Benoit Jubin and others.
Further edited by N. J. A. Sloane, Jan 28 2010
Comments