A128217 Nonnegative integers n such that the square-root of n differs from its nearest integer by less than 1/4.
0, 1, 4, 5, 8, 9, 10, 15, 16, 17, 18, 23, 24, 25, 26, 27, 34, 35, 36, 37, 38, 39, 46, 47, 48, 49, 50, 51, 52, 61, 62, 63, 64, 65, 66, 67, 68, 77, 78, 79, 80, 81, 82, 83, 84, 85, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125
Offset: 1
Keywords
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
Programs
-
Haskell
a128217 n = a128217_list !! (n-1) a128217_list = filter f [0..] where f x = 4 * abs (root - fromIntegral (round root)) < 1 where root = sqrt $ fromIntegral x -- Reinhard Zumkeller, Jun 20 2015
-
Mathematica
nsrQ[n_]:=Module[{sr=Sqrt[n]},Abs[First[sr-Nearest[{Floor[sr], Ceiling[sr]},sr]]]<1/4]; Select[Range[0,150],nsrQ] (* Harvey P. Dale, Aug 19 2011 *)
-
Python
from itertools import count, islice from math import isqrt def A128217_gen(startvalue=0): # generator of terms >= startvalue return filter(lambda n:(m:=n<<4)<(k:=(isqrt(n)<<2)+1)**2 or m>(k+2)**2, count(max(startvalue,0))) A128217_list = list(islice(A128217_gen(),40)) # Chai Wah Wu, Jun 06 2025
Extensions
Offset changed by Reinhard Zumkeller, Jun 20 2015
Comments