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!)
A087278 Nonnegative integers whose distance to the nearest square is not greater than 1. 3

%I #25 Sep 14 2022 02:02:10

%S 0,1,2,3,4,5,8,9,10,15,16,17,24,25,26,35,36,37,48,49,50,63,64,65,80,

%T 81,82,99,100,101,120,121,122,143,144,145,168,169,170,195,196,197,224,

%U 225,226,255,256,257,288,289,290,323,324,325,360,361,362,399,400,401

%N Nonnegative integers whose distance to the nearest square is not greater than 1.

%H <a href="/index/Rec#order_07">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,2,-2,0,-1,1).

%F a(3*k) = (k+1)^2 - 1 = A005563(k+1);

%F a(3*k+1) = (k+1)^2 = A000290(k+1);

%F a(3*k+2) = (k+1)^2 + 1 = A002522(k+1).

%F a(n) = floor(n/3)*(floor(n/3) + 2) + n mod 3.

%F G.f.: -x*(1+x)*(x^4-2*x^3+x^2+1) / ( (1+x+x^2)^2*(x-1)^3 ). - _R. J. Mathar_, May 22 2019

%F From _Amiram Eldar_, Sep 14 2022: (Start)

%F Sum_{n>=1} 1/a(n) = coth(Pi)*Pi/2 + Pi^2/6 + 1/4.

%F Sum_{n>=1} (-1)^(n+1)/a(n) = cosech(Pi)*Pi/2 + Pi^2/12 - 1/4. (End)

%t dnsQ[n_]:=Module[{x=Floor[Sqrt[n]]},Min[n-x^2,(x+1)^2-n]<=1]; Select[Range[0,450],dnsQ] (* _Harvey P. Dale_, May 25 2011 *)

%t Table[n^2+{-1,0,1},{n,20}]//Flatten (* _Harvey P. Dale_, Jan 17 2022 *)

%o (Python)

%o def A087278(n):

%o a, b = divmod(n,3)

%o return a*(a+2)+b # _Chai Wah Wu_, Aug 03 2022

%Y Union of A005563, A000290 and A002522.

%Y Cf. A002264, A010872, A087279.

%K nonn,easy

%O 0,3

%A _Reinhard Zumkeller_, Aug 28 2003

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 March 29 08:59 EDT 2024. Contains 371268 sequences. (Running on oeis4.)