# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/
Search: id:a006338
Showing 1-1 of 1
%I A006338 M0087 #33 Sep 08 2022 08:44:34
%S A006338 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 A006338 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 A006338 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 A006338 An "eta-sequence": floor((n+1)*sqrt(2) + 1/2) - floor(n*sqrt(2) + 1/2).
%C A006338 Equals its own "second derivative" (cf. A006337).
%C A006338 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 A006338 a(n) = A214848(n) = A022846(n+1) - A022846(n). - _Reinhard Zumkeller_, Mar 03 2014
%D A006338 Douglas Hofstadter, "Fluid Concepts and Creative Analogies", Chapter 1: "To seek whence cometh a sequence".
%D A006338 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H A006338 Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
%H A006338 D. R. Hofstadter, Eta-Lore [Cached copy, with permission]
%H A006338 D. R. Hofstadter, Pi-Mu Sequences [Cached copy, with permission]
%H A006338 D. R. Hofstadter and N. J. A. Sloane, Correspondence, 1977 and 1991
%F A006338 a(n) = floor((n+1)*sqrt(2) + 1/2) - floor(n*sqrt(2) + 1/2). - _G. C. Greubel_, Nov 18 2017
%t A006338 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 A006338 Differences[Table[Floor[n Sqrt[2]+1/2],{n,120}]] (* _Harvey P. Dale_, Dec 10 2021 *)
%o A006338 (Haskell)
%o A006338 a006338 n = a006338_list !! (n-1)
%o A006338 a006338_list = tail a214848_list
%o A006338 -- _Reinhard Zumkeller_, Mar 03 2014
%o A006338 (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 A006338 (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 A006338 Cf. A006337, A022846, A214848.
%K A006338 nonn,easy,nice
%O A006338 1,1
%A A006338 D. R. Hofstadter, Jul 15 1977
%E A006338 More terms from Antonio G. Astudillo (afg_astudillo(AT)lycos.com), Mar 28 2003
# Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE