login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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.
1
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,4
COMMENTS
A companion to A300728 where "smallest" is replaced with "largest".
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).
EXAMPLE
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.
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}]
PROG
(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
CROSSREFS
Sequence in context: A291218 A321416 A226372 * A093782 A085105 A368061
KEYWORD
nonn
AUTHOR
STATUS
approved