Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I M2172 #34 Oct 20 2023 21:13:48
%S 2,50,325,1105,5525,5525,27625,27625,71825,138125,160225,160225,
%T 801125,801125,801125,801125,2082925,2082925,4005625,4005625,5928325,
%U 5928325,5928325,5928325,29641625,29641625,29641625,29641625,29641625,29641625
%N Smallest number that is the sum of two positive squares in >= n ways.
%D J.-M. De Koninck, Ces nombres qui nous fascinent, Entry 50, p. 19, Ellipses, Paris 2008.
%D J. Meeus, Problem 1375, J. Rec. Math., 18 (No. 1, 1985), p. 70.
%D Problem 590, J. Rec. Math., 11 (No. 2, 1978), p. 137.
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H Chai Wah Wu, <a href="/A048610/b048610.txt">Table of n, a(n) for n = 1..96</a>
%H J. Meeus, <a href="/A007511/a007511.pdf">Note</a>
%H <a href="/index/Su#ssq">Index entries for sequences related to sums of squares</a>
%e 2 = 1^2 + 1^2; 50 = 1^2 + 7^2 = 5^2 + 5^2; 325 = 1^2 + 18^2 = 6^2 + 17^2 = 10^2 + 15^2.
%t (* Assuming a(n) multiple of 1105, from 1105 on, to speed up computation *) twoSquaresR[n_] := twoSquaresR[n] = With[{r = Reduce[0 < x <= y && n == x^2 + y^2, {x, y}, Integers]}, If[r === False, 0, Length[{x, y} /. {ToRules[r]}]]]; a[n_] := a[n] = For[an = a[n - 1], True, an = If[an < 1105, an + 1, an + 1105], If[ twoSquaresR[an] >= n, Return[an]]];a[1] = 2; Table[ Print[a[n]]; a[n], {n, 1, 30}] (* _Jean-François Alcover_, Jun 22 2012 *)
%t nn = 10^6; t2 = Table[0, {nn}]; n2 = Floor[Sqrt[nn]]; Do[r = a^2 + b^2; If[r <= nn, t2[[r]]++], {a, n2}, {b, a, n2}]; t = {}; n = 1; While[a = Position[t2, _?(# >= n &), 1, 1]; a != {}, AppendTo[t, a[[1, 1]]]; n++]; t (* _T. D. Noe_, Jun 22 2012 *)
%Y Cf. A016032, A007511, A052199, A071383.
%K nonn,nice
%O 1,1
%A _N. J. A. Sloane_, _Robert G. Wilson v_, _Jud McCranie_