%I #16 Oct 06 2023 05:00:16
%S 1,4,9,11,20,22,35,37,54,56,77,79,104,106,135,137,170,172,209,211,252,
%T 254,299,301,350,352,405,407,464,466,527,529,594,596,665,667,740,742,
%U 819,821,902,904,989,991,1080,1082,1175,1177,1274,1276,1377,1379,1484,1486
%N a(n) is the index of the n-th term of A365876 that includes at least one equation with at least one integer solution.
%C Observation (checked up to a(52)): a(n) = A266257(n) for n >= 2.
%C Conjectures in formula section hold for 2<=n<=300. - _Chai Wah Wu_, Oct 05 2023
%F Conjectures (see also A266257): (Start)
%F a(1) = 1, a(n) = ((n + 1)^2 - (-1)^n*(n - 1))/2 for n >= 2.
%F a(1) = 1, a(2) = 4, a(3) = 9, a(4) = 11, a(5) = 20, a(6) = 22, a(n) = a(n - 1) + 2*a(n - 2) - 2*a(n - 3) - a(n - 4) + a(n - 5) for n >= 7.
%F G.f.: (1 + x + 3*x^3 - x^4)/((1 - x)^3*(1 + x)^2). (End)
%e a(1) = 1 since the equation x^2 = 0 belonging to A365876(1) has the integer solution 0. 1 is the 1st term that includes at least one equation with at least one integer solution.
%e a(2) = 4 since the equation 2*x^2 + x - 1 = 0 belonging to A365876(4) has the integer solution -1. 4 is the 2nd term that includes at least one equation with at least one integer solution.
%e a(3) = 9 since the equation -x^2 + 4*x - 1 = 0 belonging to A365876(9) has the integer solution 2. 9 is the 3rd term that includes at least one equation with at least one integer solution.
%e a(4) = 11 since the equation 3*x^2 + 4*x - 4 = 0 belonging to A365876(11) has the integer solution -2. 11 is the 4th term that includes at least one equation with at least one integer solution.
%p A365892 := proc(n_A365876) local u, v, a, min, x_1, x_2; u := n_A365876; v := 0; a := false; min := true; while min = true do if u <> 0 and gcd(u, v) = 1 then x_1 := 1/2*(-v + sqrt(v^2 + 4*v*u))/u; x_2 := 1/2*(-v - sqrt(v^2 + 4*v*u))/u; if x_1 = floor(x_1) or x_2 = floor(x_2) then a := true; end if; end if; u := u - 2; v := 1/2*n_A365876 - 1/2*abs(u); if u < -1/9*n_A365876 then min := false; end if; end do; if a = true then return n_A365876; end if; end proc; seq(A365892(n_A365876), n_A365876 = 1 .. 1486);
%o (Python)
%o from math import gcd
%o from itertools import count, islice
%o from sympy import integer_nthroot
%o def A365892_gen(startvalue=1): # generator of terms >= startvalue
%o for n in count(max(startvalue,1)):
%o if n == 1:
%o yield 1
%o else:
%o for v in range(1,n+1>>1):
%o u = n-(v<<1)
%o if gcd(u,v)==1:
%o v2, u2, a = v*v, v*(u<<2), u<<1
%o if v2+u2 >= 0:
%o d,r = integer_nthroot(v2+u2,2)
%o if r and not ((d+v)%a and (d-v)%a):
%o yield n
%o break
%o if v2-u2 >= 0:
%o d,r = integer_nthroot(v2-u2,2)
%o if r and not ((d+v)%a and (d-v)%a):
%o yield n
%o break
%o A365892_list = list(islice(A365892_gen(),20)) # _Chai Wah Wu_, Oct 04 2023
%Y Cf. A364384, A364385, A365876, A365877.
%K nonn
%O 1,2
%A _Felix Huber_, Sep 22 2023