login
A320278
a(n) is the number of positive integers 0 < i < n such that i + n is a square.
1
0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5
OFFSET
0,14
LINKS
FORMULA
a(n) = floor(sqrt(max(0,2*n-1))) - floor(sqrt(n)). - Alois P. Heinz, Oct 27 2018
a(n) = Sum_{i=1..floor((2*n-1)/2)} c(2*n-i), where c is the square characteristic (A010052). - Wesley Ivan Hurt, Nov 26 2020
EXAMPLE
13 + 3 is a square and 13 + 12 is a square, so a(13)=2.
PROG
(PARI) a(n) = sum(i=1, n-1, issquare(i+n)); \\ Michel Marcus, Oct 09 2018
(PARI) a(n) = sqrtint(n<<1-1) - sqrtint(n+1) + issquare(n+1) \\ David A. Corneth, Oct 09 2018
CROSSREFS
Sequence in context: A135265 A144110 A076490 * A302111 A124278 A253187
KEYWORD
nonn,easy
AUTHOR
Jud McCranie, Oct 09 2018
EXTENSIONS
Offset changed to 0 by David A. Corneth, Oct 09 2018
STATUS
approved