login
a(n) is the number of nonnegative numbers k < n such that the equation (n-k)*x - k = y^2 is solvable.
1

%I #22 Oct 16 2024 21:21:46

%S 1,2,3,3,4,5,4,6,6,5,9,8,5,10,10,8,10,8,10,15,13,6,12,17,7,16,15,11,

%T 17,15,14,17,14,13,27,22,6,19,22,20,23,17,13,27,21,15,23,24,16,23,30,

%U 21,21,27,26,37,17,7,37,29,22,29,32,24,34,34,15,39,34,19,35

%N a(n) is the number of nonnegative numbers k < n such that the equation (n-k)*x - k = y^2 is solvable.

%C a(n) is the number of positive numbers j <= n such that -n is a quadratic residue mod j. - _Robert Israel_, Oct 16 2024

%H Robert Israel, <a href="/A375464/b375464.txt">Table of n, a(n) for n = 1..10000</a>

%e a(1) = 1 because (1-0)*x - 0 = y^2 is solvable where x: 0, 1, 4, 9, .. A000290;

%e a(2) = 2 because (2-0)*x - 0 = y^2 is solvable where x: 0, 2, 8, 18, .. A001105,

%e (2-1)*x - 1 = y^2 is solvable where x: 1, 2, 5, 10, .. A002522;

%e a(3) = 3 because (3-0)*x - 0 = y^2 is solvable where x: 0, 3, 12, 27, .. A033428,

%e (3-1)*x - 1 = y^2 is solvable where x: 1, 5, 13, 25, .. A001844,

%e (3-2)*x - 2 = y^2 is solvable where x: 2, 3, 6, 11, .. A059100;

%e a(4) = 3 because (4-0)*x - 0 = y^2 is solvable where x: 0, 1, 4, 9, .. A000290,

%e (4-1)*x - 1 = y^2 is unsolvable,

%e (4-2)*x - 2 = y^2 is solvable where x: 1, 3, 9, 19, .. A058331;

%e (4-3)*x - 3 = y^2 is solvable where x: 2, 3, 6, 11, .. A117950.

%p f:= proc(n) local j; add(numtheory:-quadres(-n, j)+1, j=1..n)/2 end proc:

%p map(f, [$1..100]); # _Robert Israel_, Oct 16 2024

%o (PARI) is(k, n) = for (i=0, n-1, if (issquare((n-i)*k - i), return(1)));

%o a(n) = sum(k=0, n-1, is(k, n)); \\ _Michel Marcus_, Aug 17 2024

%Y Cf. A000290, A001105, A002522, A033428, A001844, A059100, A058331, A117950, A375347.

%K nonn

%O 1,2

%A _Juri-Stepan Gerasimov_, Aug 16 2024