login
Least m > 0 for which m*n^2 + 1 is a square.
6

%I #27 Dec 22 2021 02:18:41

%S 3,2,7,3,23,8,47,15,79,24,119,2,167,48,3,63,287,80,359,6,88,120,527,

%T 28,623,168,727,12,839,44,959,255,216,288,8,20,1367,360,19,77,1679,22,

%U 1847,30,208,528,2207,7,2399,624,128,42,2807,728,696,3,160,840,3479,11

%N Least m > 0 for which m*n^2 + 1 is a square.

%C Least m > 0 for which x^2 - m*y^2 = 1 has a solution with y = n.

%C For n > 1, a(n) <= n^2-2. - _Chai Wah Wu_, Jan 26 2016

%H T. D. Noe and Chai Wah Wu, <a href="/A067872/b067872.txt">Table of n, a(n) for n = 1..10000</a> n = 1..500 from T. D. Noe

%F For n a power of an odd prime, a(n) = n^2 - 2. For n twice a power of an odd prime, a(n) = (n/2)^2 - 1. - _T. D. Noe_, Sep 13 2007

%e a(4)=3, based on 3*4^2 + 1 = 7^2.

%t a[n_] := For[m=1, True, m++, If[IntegerQ[Sqrt[m*n^2+1]], Return[m]]]; Table[a[n], {n, 100}]

%t lm[n_]:=Module[{m=1},While[!IntegerQ[Sqrt[m n^2+1]],m++];m]; Array[lm,60] (* _Harvey P. Dale_, Feb 24 2013 *)

%o (Haskell)

%o a067872 n = (until ((== 1) . a010052 . (+ 1)) (+ nn) nn) `div` nn

%o where nn = n ^ 2

%o -- _Reinhard Zumkeller_, Jun 28 2013

%o (Python)

%o def A067872(n):

%o y, x, n2 = n*(n+2), 2*n+3, n**2

%o m, r = divmod(y,n2)

%o while r:

%o y += x

%o x += 2

%o m, r = divmod(y,n2)

%o return m # _Chai Wah Wu_, Jan 25 2016

%Y Cf. A033318, A068310.

%Y Cf. A010052.

%K nice,nonn

%O 1,1

%A _Lekraj Beedassy_, Feb 25 2002

%E Edited by _Dean Hickerson_, Mar 19 2002