OFFSET
1,2
COMMENTS
This sequence is infinite because k = x^2 + 1 is a term, where a = x + 1, b = x^2 + 1 and c = x^4 + x^3 + 3*x^2 + 2*x + 1. There are other forms of k:
k = (a^2-a+2)^2 - 2 when a + b = 1 and c = a^2 - a + 1.
k = x^4 + 2*x^3 + 5*x^2 + 4*x + 2 when a = k*(b+c) + x, b = x^2 + x + 1 and c = x + 1.
k = ((a^2+a*b+b^2)^2 - 2*a*b + 1)/(a + b)^2 when a = Fibonacci(2*m-1), b = Fibonacci(2*m) and c = ((a^2+a*b+b^2)^2 - a*b)/(a + b).
a(n) == 1 or 2 (mod 4). Proof: a^2 - k*(b+c)*a + (b^2+c^2-k*b*c) = 0, hence discriminant D = (k^2-4)*(b^2+c^2) + (2*k^2+4*k)*b*c is a square. Because (a/g, b/g, c/g) is also a set of solution if k = (a^2 + b^2 + c^2)/(a*b + b*c + c*a) and gcd(a, b, c) = g, we only need to consider the case of gcd(a,b,c) = 1.
Case (i). k = 4*r, then D/4 = (4*r^2-1)*(b^2+c^2) + (8*r^2+4*r)*b*c == 2 or 3 (mod 4), hence D is not a square, a contradiction.
Case (ii). k = 4*r - 1, then (a+b)^2 + (b+c)^2 + (c+a)^2 = 8*r*(a*b + b*c + c*a) is divisible by 4, hence a, b and c are odd numbers. Therefore, ((a+b)^2 + (b+c)^2 + (c+a)^2)/4 == 1 (mod 2), a contradiction.
a(n) is never divisible by 3. This follows from writing the equation as (a+b+c)^2 = (k+2)(ab+ac+bc) and then working mod a prime p==2 (mod 3) dividing k+2 an odd number of times. See linked Quora answer below. - Alon Amit, Aug 11 2024
k is in the sequence iff k-1 and k+2 are both Loeschian numbers (A003136). This can be proved with Legendre's theorem. - Yifan Xie, Feb 15 2025
From Michael Shmoish, Jan 10 2026: (Start)
k is in the sequence iff the squarefree part of (k-1)*(k+2) contains no prime factors of the form 3*j+2.
a(n) = A392201(n) - 1 since (x^2 + y^2 + z^2)/(x*y - y*z + x*z) = k >= 1 for some integers x, y and z if and only if the squarefree part of (k-2)*(k+1) contains no prime factors of the form 3*j+2. (End)
LINKS
FORMULA
EXAMPLE
a(4) = 10 because 10 = ((-1)^2 + 2^2 + 5^2)/((-1)*2 + 2*5 + 5*(-1)).
PROG
(Python)
from itertools import count, islice
from sympy import factorint
def A331605_gen(startvalue=1): # generator of terms >= startvalue
return filter(lambda n: all(e&1 == 0 for p, e in factorint(n-1).items() if p % 3 == 2) and all(e&1 == 0 for p, e in factorint(n+2).items() if p % 3 == 2), count(max(startvalue, 1)))
CROSSREFS
KEYWORD
nonn
AUTHOR
Jinyuan Wang, Jan 22 2020
EXTENSIONS
a(22)-a(57) from Giovanni Resta, Jan 29 2020
STATUS
approved
