A300728 a(n) is the smallest 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, 5, 0, 3, 10, 8, 7, 15, 6, 24, 20, 35, 16, 9, 5, 63, 30, 80, 12, 24, 48, 120, 11, 15, 70, 45, 32, 195, 18, 224, 10, 7, 126, 13, 60, 323, 160, 16, 24, 399, 48, 440, 96, 27, 240, 528, 15, 56, 30, 40, 140, 675, 90, 33, 9, 55, 390, 840, 36, 899, 448, 17, 20, 39, 14, 1088, 252, 91, 26, 1224, 33, 1295, 646, 45
Offset: 0
Examples
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.
Links
- Altug Alkan, Table of n, a(n) for n = 0..10000
- Altug Alkan, Scatterplot of first differences for n <= 10^4
Programs
-
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 *)
-
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
Comments