A001030 Fixed under 1 -> 21, 2 -> 211.
2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2
Offset: 1
References
- Midhat J. Gazale, Number: From Ahmes to Cantor, Section on 'Cleavages' in Chapter 6, Princeton University Press, Princeton, NJ 2000, pp. 203-211.
- N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
- N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
Links
- T. D. Noe, Table of n, a(n) for n=1..8119
- N. G. de Bruijn, Sequences of zeros and ones generated by special production rules, Indag. Math., 43 (1981), 27-37.
- D. R. Hofstadter, Eta-Lore [Cached copy, with permission]
- D. R. Hofstadter, Pi-Mu Sequences [Cached copy, with permission]
- D. R. Hofstadter and N. J. A. Sloane, Correspondence, 1977 and 1991
- A. Nagel, A self-defining infinite sequence, with an application to Markoff chains and probability, Math. Mag., 36 (1963), 179-183.
- N. J. A. Sloane, Handwritten notes on Self-Generating Sequences, 1970 (note that A1148 has now become A005282).
- N. J. A. Sloane, Families of Essentially Identical Sequences, Mar 24 2021 (Includes this sequence).
Crossrefs
Length of the sequence after 'n' substitution steps is given by the terms of A000129.
Equals A004641(n) + 1.
The following sequences are all essentially the same, in the sense that they are simple transformations of each other, with A000201 as the parent: A000201, A001030, A001468, A001950, A003622, A003842, A003849, A004641, A005614, A014675, A022342, A088462, A096270, A114986, A124841. - N. J. A. Sloane, Mar 11 2021
Programs
-
Haskell
Following Spage's PARI program. a001030 n = a001030_list !! (n-1) a001030_list = [2, 1, 1, 2] ++ f [2] [2, 1, 1, 2] where f us vs = ws ++ f vs (vs ++ ws) where ws = 1 : us ++ 1 : vs -- Reinhard Zumkeller, Aug 04 2014
-
Mathematica
('n' is the number of substitution steps to perform.) Nest[Flatten[ # /. {1 -> {2, 1}, 2 -> {2, 1, 1}}] &, {1}, n] SubstitutionSystem[{1->{2,1},2->{2,1,1}},{2},{6}][[1]] (* Harvey P. Dale, Feb 15 2022 *)
-
PARI
/* Fast string concatenation method giving e.g. 5740 terms in 8 iterations */ a="2";b="2,1,1,2";print1(b);for(x=1,8,c=concat([",1,",a,",1,",b]);print1(c);a=b;b=concat(b,c)) \\ K. Spage, Oct 08 2009
-
Python
from math import isqrt def A001030(n): return [2, 1, 1, 2, 1, 2, 1, 2][n-1] if n < 9 else -isqrt(m:=(n-9)*(n-9)<<1)+isqrt(m+(n-9<<2)+2) # Chai Wah Wu, Aug 25 2022
Formula
a(n) = -1 + floor(n*(1+sqrt(2))+1/sqrt(2))-floor((n-1)*(1+sqrt(2))+1/sqrt(2)). - Benoit Cloitre, Jun 26 2004. [I don't know if this is a theorem or a conjecture. - N. J. A. Sloane, May 14 2008]
This is a theorem, following from Hofstadter's Generalized Fundamental Theorem of eta-sequences on page 10 of Eta-Lore. See also de Bruijn's paper from 1981 (hint from Benoit Cloitre). - Michel Dekking, Jan 22 2017
Extensions
More terms from Peter Bertok (peter(AT)bertok.com), Nov 27 2001
Comments