|
|
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
|
|
|
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
(Python)
from math import isqrt
def a(n): return isqrt(2*n) - isqrt(n-1)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,easy
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|