The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A006337 An "eta-sequence": a(n) = floor( (n+1)*sqrt(2) ) - floor( n*sqrt(2) ).
(Formerly M0086)
35
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, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
Defined by: (i) a(1) = 1; (ii) sequence consists of single 2's separated by strings of 1's; (iii) the sequence of lengths of runs of 1's in the sequence is equal to the sequence.
Equals its own "derivative", which is formed by counting the strings of 1's that lie between 2's.
First differences of A001951 (with a different offset). - Philippe Deléham, May 29 2006
Or number of perfect squares in interval (2*n^2, 2*(n+1)^2). In view of the uniform distribution mod 1 of sequence {sqrt(2)*n}, the density of 1's is 2-sqrt(2). - Vladimir Shevelev, Aug 05 2011
a(n) = number of repeating n's in A049472. - Reinhard Zumkeller, Jul 03 2015
Fixed point of the morphism 1 -> 12; 2 -> 121. - Jeffrey Shallit, Jan 19 2017
REFERENCES
Douglas Hofstadter, "Fluid Concepts and Creative Analogies", Chapter 1: "To seek whence cometh a sequence".
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
F. M. Dekking, On the structure of self-generating sequences, Seminar on Number Theory, 1980-1981 (Talence, 1980-1981), Exp. No. 31, 6 pp., Univ. Bordeaux I, Talence, 1981. Math. Rev. 83e:10075.
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
C. Kimberling, Problem 6281, Amer. Math. Monthly 86 (1979), no. 9, 793.
N. J. A. Sloane, Families of Essentially Identical Sequences, Mar 24 2021 (Includes this sequence)
FORMULA
Let S(0) = 1; obtain S(k) from S(k-1) by applying 1 -> 12, 2 -> 112; sequence is S(0), S(1), S(2), ... - Matthew Vandermast, Mar 25 2003
a(A003152(n)) = 1 and a(A003151(n)) = 2. - Philippe Deléham, May 29 2006
a(n) = A159684(n-1) + 1. - Filip Zaludek, Oct 28 2016
MAPLE
Digits := 100; sq2 := sqrt(2.); A006337 := n->floor((n+1)*sq2)-floor(n*sq2);
MATHEMATICA
Flatten[ Table[ Nest[ Flatten[ # /. {1 -> {1, 2}, 2 -> {1, 1, 2}}] &, {1}, n], {n, 5}]] (* Robert G. Wilson v, May 06 2005 *)
Differences[ Table[ Floor[ n*Sqrt[2]], {n, 1, 106}]] (* Jean-François Alcover, Apr 06 2012 *)
PROG
(PARI) a(n)=sqrt(2)*(n+1)\1-sqrt(2)*n\1 \\ Charles R Greathouse IV, Apr 06 2012
(PARI) a(n)=sqrtint(2*n^2+4*n+2)-sqrtint(2*n^2) \\ Charles R Greathouse IV, Apr 06 2012
(Haskell)
a006337 n = a006337_list !! (n-1)
a006337_list = f [1] where
f xs = ys ++ f ys where
ys = concatMap (\z -> if z == 1 then [1, 2] else [1, 1, 2]) xs
-- Reinhard Zumkeller, May 06 2012
(Python)
from math import isqrt
def A006337(n): return -isqrt(m:=n*n<<1)+isqrt(m+(n<<2)+2) # Chai Wah Wu, Aug 03 2022
CROSSREFS
Cf. A006338. Exchanging 1's and 2's gives A080763. Essentially same as A004641 + 1.
Cf. A049472.
The following sequences are all essentially the same, in the sense that they are simple transformations of each other, with A003151 as the parent: A003151, A001951, A001952, A003152, A006337, A080763, A082844 (conjectured), A097509, A159684, A188037, A245219 (conjectured), A276862. - N. J. A. Sloane, Mar 09 2021
Sequence in context: A214364 A175922 A214856 * A214848 A006338 A020903
KEYWORD
nonn,easy,nice
AUTHOR
D. R. Hofstadter, Jul 15 1977
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 19 02:48 EDT 2024. Contains 372666 sequences. (Running on oeis4.)