cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A300728 #33 Nov 12 2023 00:06:45
%S A300728 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,
%T A300728 70,45,32,195,18,224,10,7,126,13,60,323,160,16,24,399,48,440,96,27,
%U A300728 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
%N 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.
%C A300728 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.
%C A300728 From _Robert Israel_, Mar 12 2018: (Start)
%C A300728 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.
%C A300728 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.
%C A300728 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)
%H A300728 Altug Alkan, <a href="/A300728/b300728.txt">Table of n, a(n) for n = 0..10000</a>
%H A300728 Altug Alkan, <a href="/A300728/a300728_1.png">Scatterplot of first differences for n <= 10^4</a>
%e A300728 a(2) = 0 because k^2 + 2*k + 4 = (k + 1)^2 + 3 cannot be a square for k > 0.
%e A300728 a(4) = 0 because k^2 + 4*k + 16 = (k + 2)^2 + 12 cannot be a square for k > 0.
%e A300728 a(5) = 3 because 3^2 + 3*5 + 5^2 = 7^2 and 3 is the least positive number with this property.
%p A300728 f:= proc(n) local k;
%p A300728 for k from 1 do if issqr(k^2 + k*n + n^2) then return k fi od
%p A300728 end proc:
%p A300728 f(1):= 0: f(2):= 0: f(4):= 0:
%p A300728 map(f, [$0..200]); # _Robert Israel_, Mar 12 2018
%t A300728 f[n_] := Module[{k},
%t A300728 For[k = 1, True, k++, If[IntegerQ[Sqrt[k^2 + k*n + n^2]], Return[k]]]];
%t A300728 f[1] = 0; f[2] = 0; f[4] = 0;
%t A300728 Map[f, Range[0, 200]] (* _Jean-François Alcover_, Nov 11 2023, after _Robert Israel_ *)
%o A300728 (Python)
%o A300728 from sympy.abc import x, y
%o A300728 from sympy.solvers.diophantine.diophantine import diop_quadratic
%o A300728 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
%Y A300728 Cf. A000290, A003136, A055527.
%K A300728 nonn,look
%O A300728 0,4
%A A300728 _Altug Alkan_, Mar 11 2018