OFFSET
1,2
COMMENTS
a(n) is the number of positive numbers j <= n such that -n is a quadratic residue mod j. - Robert Israel, Oct 16 2024
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(1) = 1 because (1-0)*x - 0 = y^2 is solvable where x: 0, 1, 4, 9, .. A000290;
a(2) = 2 because (2-0)*x - 0 = y^2 is solvable where x: 0, 2, 8, 18, .. A001105,
(2-1)*x - 1 = y^2 is solvable where x: 1, 2, 5, 10, .. A002522;
a(3) = 3 because (3-0)*x - 0 = y^2 is solvable where x: 0, 3, 12, 27, .. A033428,
(3-1)*x - 1 = y^2 is solvable where x: 1, 5, 13, 25, .. A001844,
(3-2)*x - 2 = y^2 is solvable where x: 2, 3, 6, 11, .. A059100;
a(4) = 3 because (4-0)*x - 0 = y^2 is solvable where x: 0, 1, 4, 9, .. A000290,
(4-1)*x - 1 = y^2 is unsolvable,
(4-2)*x - 2 = y^2 is solvable where x: 1, 3, 9, 19, .. A058331;
(4-3)*x - 3 = y^2 is solvable where x: 2, 3, 6, 11, .. A117950.
MAPLE
f:= proc(n) local j; add(numtheory:-quadres(-n, j)+1, j=1..n)/2 end proc:
map(f, [$1..100]); # Robert Israel, Oct 16 2024
PROG
(PARI) is(k, n) = for (i=0, n-1, if (issquare((n-i)*k - i), return(1)));
a(n) = sum(k=0, n-1, is(k, n)); \\ Michel Marcus, Aug 17 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Juri-Stepan Gerasimov, Aug 16 2024
STATUS
approved