login
a(n) is the number of positive integers 0 < i < n such that i + n is a square.
1

%I #31 Nov 26 2020 22:01:52

%S 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,

%T 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,

%U 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

%N a(n) is the number of positive integers 0 < i < n such that i + n is a square.

%H Seiichi Manyama, <a href="/A320278/b320278.txt">Table of n, a(n) for n = 0..10000</a>

%F a(n) = floor(sqrt(max(0,2*n-1))) - floor(sqrt(n)). - _Alois P. Heinz_, Oct 27 2018

%F 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

%e 13 + 3 is a square and 13 + 12 is a square, so a(13)=2.

%o (PARI) a(n) = sum(i=1, n-1, issquare(i+n)); \\ _Michel Marcus_, Oct 09 2018

%o (PARI) a(n) = sqrtint(n<<1-1) - sqrtint(n+1) + issquare(n+1) \\ _David A. Corneth_, Oct 09 2018

%Y Cf. A000196, A010052.

%K nonn,easy

%O 0,14

%A _Jud McCranie_, Oct 09 2018

%E Offset changed to 0 by _David A. Corneth_, Oct 09 2018