A367191 a(n) is the largest positive number k such that k^2 + k*n + n^2 is a perfect square, or 0 if no such k exists.
0, 0, 0, 5, 0, 16, 10, 33, 7, 56, 32, 85, 20, 120, 66, 161, 39, 208, 112, 261, 64, 320, 170, 385, 95, 456, 240, 533, 132, 616, 322, 705, 175, 800, 416, 901, 224, 1008, 522, 1121, 279, 1240, 640, 1365, 340, 1496, 770, 1633, 407, 1776, 912, 1925, 480, 2080, 1066, 2241, 559, 2408, 1232, 2581, 644, 2760, 1410, 2945
Offset: 0
Keywords
Examples
With n = 7, the solutions to k^2 + k*n + n^2 = j^2 are k = 8 and k = 33, therefore A300728(7) = 8 and a(7) = 33.
Programs
-
Mathematica
s[n_] := Solve[j > 0 && k > 0 && k^2 + k*n + n^2 == j^2, {j, k},Integers]; a[n_] := If[n == 0, 0, With[{sn = s[n]}, Which[sn == {}, 0, IntegerQ[k /. sn[[1]]], Max[k /. sn], True, 0]]]; Table[a[n], {n, 0, 100}]
-
Python
from sympy.abc import x,y from sympy.solvers.diophantine.diophantine import diop_quadratic def A367191(n): return max(diop_quadratic(x*(x+n)+n**2-y**2))[0] if n else 0 # Chai Wah Wu, Nov 11 2023
Formula
Conjectured formulas according to n mod 4 in first column.
0, (n/4 - 1)(3n/4 + 1),
1 or 3, 4((n + 3)/4 - 1)(3(n + 3)/4 - 2),
2, 2((n + 2)/4 - 1)(3(n + 2)/4 - 1).
Comments