%I #35 Jun 21 2021 15:09:10
%S 1,1,9,4,4,441,25,1,9,9,1,3218436,49,1089,1656369,16,16,225,46225,9,
%T 81,314721,1,12217323024,25,25,2427192623025,1,2304,199572129,121,400,
%U 81225,39727809,4,36,36,4,736164,94864,592900,4357032433168041,169,3025,3600,1
%N a(n) is the smallest square s > 0 such that s*(2n+1) is a triangular number.
%C 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).
%t Table[k=1;While[!IntegerQ[Sqrt[8k^2(2n+1)+1]],k++];k^2,{n,0,22}] (* _Giorgos Kalogeropoulos_, Jun 03 2021 *)
%o (C#)
%o static BigInteger a(int n)
%o {
%o // The next lines solve the Pell equation x^2 - D y^2 = 1
%o int D = 4 * n + 2;
%o BigInteger num = 0;
%o BigInteger den = 0;
%o if (n < 0)
%o return 0;
%o BigInteger limit = (int)Math.Sqrt(D);
%o BigInteger m = 0;
%o BigInteger d = 1;
%o BigInteger a = limit;
%o BigInteger numm1 = 1;
%o num = a;
%o BigInteger denm1 = 0;
%o den = 1;
%o while (num * num - D * den * den != 1)
%o {
%o m = d * a - m;
%o d = (D - m * m) / d;
%o a = (limit + m) / d;
%o BigInteger numm2 = numm1;
%o numm1 = num;
%o BigInteger denm2 = denm1;
%o denm1 = den;
%o num = a * numm1 + numm2;
%o den = a * denm1 + denm2;
%o }
%o // The list square is computed
%o BigInteger square = (den * den) / 4;
%o return square;
%o }
%o (PARI) a(n) = my(k=1); while (!ispolygonal(k^2*(2*n+1), 3), k++); k^2; \\ _Michel Marcus_, Jun 06 2021
%o (Python)
%o from sympy.solvers.diophantine.diophantine import diop_DN
%o def A344949(n): return min(d[1]**2 for d in diop_DN(4*n+2, 1))//4 # _Chai Wah Wu_, Jun 21 2021
%Y Cf. A000217, A000290, A061782.
%K nonn
%O 0,3
%A _Mihai Prunescu_, Jun 03 2021
|