%I M0087 #33 Sep 08 2022 08:44:34
%S 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,
%T 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,
%U 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
%N An "eta-sequence": floor((n+1)*sqrt(2) + 1/2) - floor(n*sqrt(2) + 1/2).
%C Equals its own "second derivative" (cf. A006337).
%C Presumably this is the same as the following sequence from Hofstadter's book: the number of triangular numbers between each successive pair of squares. More precisely, a(n) is the number of triangular numbers T such that n^2 <= T < (n+1)^2. E.g., a(3) = 2 because 3^2 <= T < 4^2 permits T(4) = 10 and T(5) = 15 and no other triangular number. - _Hugo van der Sanden_, May 03 2005.
%C a(n) = A214848(n) = A022846(n+1) - A022846(n). - _Reinhard Zumkeller_, Mar 03 2014
%D Douglas Hofstadter, "Fluid Concepts and Creative Analogies", Chapter 1: "To seek whence cometh a sequence".
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H Reinhard Zumkeller, <a href="/A006338/b006338.txt">Table of n, a(n) for n = 1..10000</a>
%H D. R. Hofstadter, <a href="/A006336/a006336_1.pdf">Eta-Lore</a> [Cached copy, with permission]
%H D. R. Hofstadter, <a href="/A006336/a006336_2.pdf">Pi-Mu Sequences</a> [Cached copy, with permission]
%H D. R. Hofstadter and N. J. A. Sloane, <a href="/A006336/a006336.pdf">Correspondence, 1977 and 1991</a>
%F a(n) = floor((n+1)*sqrt(2) + 1/2) - floor(n*sqrt(2) + 1/2). - _G. C. Greubel_, Nov 18 2017
%t a[n_] := Floor[(n+1)*Sqrt[2]+1/2] - Floor[n*Sqrt[2]+1/2]; Table[a[n], {n, 1, 105}] (* _Jean-François Alcover_, Nov 24 2015 *)
%t Differences[Table[Floor[n Sqrt[2]+1/2],{n,120}]] (* _Harvey P. Dale_, Dec 10 2021 *)
%o (Haskell)
%o a006338 n = a006338_list !! (n-1)
%o a006338_list = tail a214848_list
%o -- _Reinhard Zumkeller_, Mar 03 2014
%o (PARI) for(n=1,30, print1(floor((n+1)*sqrt(2) + 1/2) - floor(n*sqrt(2) + 1/2), ", ")) \\ _G. C. Greubel_, Nov 18 2017
%o (Magma) [Floor((n+1)*Sqrt(2)+1/2) - Floor(n*Sqrt(2)+1/2): n in [1..30]]; // _G. C. Greubel_, Nov 18 2017
%Y Cf. A006337, A022846, A214848.
%K nonn,easy,nice
%O 1,1
%A D. R. Hofstadter, Jul 15 1977
%E More terms from Antonio G. Astudillo (afg_astudillo(AT)lycos.com), Mar 28 2003