login
a(n) is the number of quadratic equations u*x^2 + v*x + w = 0 with distinct solution sets L != {}, integer coefficients u, v, w and GCD(u, v, w) = 1, where n = abs(u) + abs(v) + abs(w) and the sum of the solutions equals the product of the solutions.
5

%I #22 Oct 05 2023 08:37:35

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

%T 9,11,8,14,7,20,10,13,9,22,7,23,11,13,12,26,9,24,11,18,13,29,10,22,14,

%U 20,15,32,9,33,16,20,18,27,11,37,18,25,13,39,13,40,20

%N a(n) is the number of quadratic equations u*x^2 + v*x + w = 0 with distinct solution sets L != {}, integer coefficients u, v, w and GCD(u, v, w) = 1, where n = abs(u) + abs(v) + abs(w) and the sum of the solutions equals the product of the solutions.

%C According to Vieta's formulas, x_1 + x_2 = -v/u and x_1*x_2 = w/u. So x_1 + x_2 = x_1*x_2 when v = -w. Furthermore, the discriminant must not be negative, i.e., v^2 - 4*u*w = v^2 + 4*u*v >= 0.

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Quadratic_equation">Quadratic equation</a>.

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Vieta%27s_formulas">Vieta's formulas</a>.

%e For n = 9 the a(9) = 4 equations are given by (u, v, w) = (7, 1, -1), (5, 2, -2), (1, 4, -4), (-1, 4, -4).

%e Equations multiplied by -1 do not have a different solution set; for example, (-7, -1, 1) has the same solution set as (7, 1, -1).

%e Equations with GCD(u, v, w) != 1 are excluded, because their solution sets are assigned to equations with lower n. For example, (3, 3, -3) is not included here, because its solution set is already assigned to (1, 1, -1).

%e Equations with a double solution are considered to have two equal solutions. For example, (-1, 4, -4) has the two solutions x_1 = x_2 = 2.

%p A365876:= proc(n) local u, v, a, min; u := n; v := 0; a := 0; min := true; while min = true do if u <> 0 and gcd(u, v) = 1 then a := a + 1; end if; u := u - 2; v:=(n-abs(u))/2; if u < -1/9*n then min := false; end if; end do; return a; end proc; seq(A365876(n), n = 1 .. 74);

%o (Python)

%o from math import gcd

%o def A365876(n):

%o if n == 1: return 1

%o c = 0

%o for v in range(1,n+1>>1):

%o u = n-(v<<1)

%o if gcd(u,v)==1:

%o v2, u2 = v*v, v*(u<<2)

%o if v2+u2 >= 0:

%o c +=1

%o if v2-u2 >= 0:

%o c +=1

%o return c # _Chai Wah Wu_, Oct 04 2023

%Y Cf. A364384, A364385, A365877 (partial sums), A365892.

%K nonn

%O 1,5

%A _Felix Huber_, Sep 22 2023