OFFSET
1,1
FORMULA
a(n) = Sum_{u = 1..n} b(floor(n/u)), where b = A067274 (obtained in collaboration with Sean A. Irvine). Proof sketch: consider a polynomial u*x^2+v*x+w with integer roots r and s. Then v = -u*(r+s) and w = u*r*s; so the constraint max(|v|, |w|) <= n is equivalent to max(|r+s|, |r*s|) <= floor(n/u). Therefore, the number of admissible pairs (r, s) is b(floor(n/u)) and the formula follows.
EXAMPLE
For n = 1, the a(1) = 4 polynomials with coefficients in {-1, 0, 1} are: x^2-x, x^2-1, x^2, x^2+x.
For n = 2, the a(2) = 14 polynomials with coefficients in {-2, -1, 0, 1, 2} are: x^2-2x, x^2-2x+1, x^2-x-2, x^2-x, x^2-1, x^2, x^2+x-2, x^2+x, x^2+2x, x^2+2x+1, 2x^2-2x, 2x^2-2, 2x^2, 2x^2+2x.
PROG
(Python)
from math import isqrt
def A067274(n): return (n-(s:=isqrt(n))**2+(sum(n//k for k in range(1, s+1))<<1)<<1)+s-1 if n else 1
def A391597(n):
c, j = 0, 1
while j <= n:
c += A067274(k:=n//j)*(-j+(j:=n//k+1))
return c # Chai Wah Wu, Jan 28 2026
CROSSREFS
KEYWORD
nonn
AUTHOR
Lorenzo Sauras Altuzarra, Jan 12 2026
STATUS
approved
