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!)
A105224 Number of squares between n and 2*n inclusive. 5
1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 4, 4, 4, 4, 4 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,8
COMMENTS
a(n)>=1 because between n and 2*n there is always at least one square.
LINKS
FORMULA
a(n) = A000196(2*n) - A000196(n-1).
EXAMPLE
a(8)=2 because between 8 and 16 (inclusive) there are two squares: 3^2 = 9 and 4^2 = 16.
MATHEMATICA
f[n_] := Floor[Sqrt[n]]; Table[f[2n] - f[n - 1], {n, 100}]
PROG
(PARI) first(n) = { my(res = vector(n), t = 1); res[1] = 1; for(i = 2, n, t+=(issquare(2*i) + issquare(2*i-1) - issquare(i-1)); res[i] = t ); res } \\ David A. Corneth, Jul 22 2021
(PARI) a(n) = sqrtint(2*n)-sqrtint(n-1) \\ David A. Corneth, Jul 22 2021
(Python)
from math import isqrt
def a(n): return isqrt(2*n) - isqrt(n-1)
print([a(n) for n in range(1, 106)]) # Michael S. Branicky, Jul 22 2021
CROSSREFS
Sequence in context: A331383 A201208 A006513 * A261627 A237112 A238013
KEYWORD
nonn,easy
AUTHOR
Giovanni Teofilatto, Apr 14 2005
EXTENSIONS
Edited and extended by Ray Chandler, Apr 16 2005
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 June 3 16:13 EDT 2024. Contains 373063 sequences. (Running on oeis4.)