OFFSET
0,3
COMMENTS
Proof that every odd natural number 2n+1 is a triangular number divided by a square. As the number 4n + 2 is never a square, Pell's equation x^2 - (4n+2)*y^2 = 1 has solutions in integers with y != 0 for every n. It is immediate that x has to be odd. We replace x = 2b+1 and we observe that y must be then even. We replace y = 2a and it follows that b(b+1)/2 = (2n+1)*a^2. So (2n+1) is a triangular number divided by a square. Of course, for given n, there are infinitely many such pairs (b,a).
MATHEMATICA
Table[k=1; While[!IntegerQ[Sqrt[8k^2(2n+1)+1]], k++]; k^2, {n, 0, 22}] (* Giorgos Kalogeropoulos, Jun 03 2021 *)
PROG
(C#)
static BigInteger a(int n)
{
// The next lines solve the Pell equation x^2 - D y^2 = 1
int D = 4 * n + 2;
BigInteger num = 0;
BigInteger den = 0;
if (n < 0)
return 0;
BigInteger limit = (int)Math.Sqrt(D);
BigInteger m = 0;
BigInteger d = 1;
BigInteger a = limit;
BigInteger numm1 = 1;
num = a;
BigInteger denm1 = 0;
den = 1;
while (num * num - D * den * den != 1)
{
m = d * a - m;
d = (D - m * m) / d;
a = (limit + m) / d;
BigInteger numm2 = numm1;
numm1 = num;
BigInteger denm2 = denm1;
denm1 = den;
num = a * numm1 + numm2;
den = a * denm1 + denm2;
}
// The list square is computed
BigInteger square = (den * den) / 4;
return square;
}
(PARI) a(n) = my(k=1); while (!ispolygonal(k^2*(2*n+1), 3), k++); k^2; \\ Michel Marcus, Jun 06 2021
(Python)
from sympy.solvers.diophantine.diophantine import diop_DN
def A344949(n): return min(d[1]**2 for d in diop_DN(4*n+2, 1))//4 # Chai Wah Wu, Jun 21 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Mihai Prunescu, Jun 03 2021
STATUS
approved