OFFSET
0,4
COMMENTS
A positive a(n) cannot be 1 or a multiple of n for n > 0 since there is no square in A002061 except 1. Also it is easy to show that a(n) cannot be 2 or 4 since a(2) = a(4) = 0.
From Robert Israel, Mar 12 2018: (Start)
If n >= 5 is odd, a(n) <= n^2/4 - n/2 - 3/4, with a(n) = n^2/4 - n/2 - 3/4 if n is a prime >= 5.
If n >= 10 and n == 2 (mod 4), a(n) <= n^2/8 - n/2 - 3/2, with equality if n/2 is a prime >= 5.
If n >= 16 and n == 0 (mod 4), 1 < a(n) <= n^2/16 - n/2 - 3, with equality if n/4 is 4 or a prime >= 5. (End)
LINKS
Altug Alkan, Table of n, a(n) for n = 0..10000
Altug Alkan, Scatterplot of first differences for n <= 10^4
EXAMPLE
a(2) = 0 because k^2 + 2*k + 4 = (k + 1)^2 + 3 cannot be a square for k > 0.
a(4) = 0 because k^2 + 4*k + 16 = (k + 2)^2 + 12 cannot be a square for k > 0.
a(5) = 3 because 3^2 + 3*5 + 5^2 = 7^2 and 3 is the least positive number with this property.
MAPLE
f:= proc(n) local k;
for k from 1 do if issqr(k^2 + k*n + n^2) then return k fi od
end proc:
f(1):= 0: f(2):= 0: f(4):= 0:
map(f, [$0..200]); # Robert Israel, Mar 12 2018
MATHEMATICA
f[n_] := Module[{k},
For[k = 1, True, k++, If[IntegerQ[Sqrt[k^2 + k*n + n^2]], Return[k]]]];
f[1] = 0; f[2] = 0; f[4] = 0;
Map[f, Range[0, 200]] (* Jean-François Alcover, Nov 11 2023, after Robert Israel *)
PROG
(Python)
from sympy.abc import x, y
from sympy.solvers.diophantine.diophantine import diop_quadratic
def A300728(n): return min((d[0] for d in diop_quadratic(x*(x+n)+n**2-y**2) if d[0]>0), default=0) if n else 1 # Chai Wah Wu, Nov 11 2023
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Altug Alkan, Mar 11 2018
STATUS
approved