login
Least m > 0 such that (n+m)^2 - m^2 (= n^2 + 2*m*n) is a square.
1

%I #18 Sep 08 2022 08:45:58

%S 4,3,12,6,20,9,28,5,8,15,44,18,52,21,60,10,68,7,76,30,84,33,92,15,12,

%T 39,24,42,116,45,124,9,132,51,140,14,148,57,156,25,164,63,172,66,40,

%U 69,188,30,16,11,204,78,212,21,220,35,228,87,236,90,244,93,56,18

%N Least m > 0 such that (n+m)^2 - m^2 (= n^2 + 2*m*n) is a square.

%H Bruno Berselli, <a href="/A193800/b193800.txt">Table of n, a(n) for n = 1..1000</a>

%e a(1)=4 is the smallest positive integer such that 1^2+2*1*a(1) is a square, here 1+2*4 = 3^2.

%e a(2)=3 is the smallest positive integer such that 2^2+2*2*a(2) is a square, here 4+4*3 = 4^2.

%e a(3)=12 is the smallest positive integer such that 3^2+2*3*a(3) is a square, here 9+6*12 = 9^2.

%t f[n_] := Block[{k = 1}, While[ !IntegerQ[ Sqrt[ n^2 + 2 n*k]], k++]; k]; Array[f, 64] (* _Robert G. Wilson v_, Jun 05 2014 *)

%o (PARI) a(n)=for(m=1,1e9,issquare((n+m)^2-m^2)&return(m))

%o (Magma)

%o S:=[];

%o m:=1;

%o for n in [1..65] do

%o while not IsSquare((n+m)^2-m^2) do

%o m:=m+1;

%o end while;

%o Append(~S, m);

%o m:=1;

%o end for;

%o S; // _Bruno Berselli_, Jan 29 2013

%K nonn

%O 1,1

%A _M. F. Hasler_, Aug 05 2011