Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #23 Mar 20 2024 23:09:42
%S 2,5,10,8,26,13,50,20,18,29,122,25,170,53,34,32,290,45,362,41,58,125,
%T 530,52,50,173,90,65,842,61,962,80,130,293,74,72,1370,365,178,89,1682,
%U 85,1850,137,106,533,2210,100,98,125,298,185,2810,117,146,113,370
%N a(n) is the smallest number k such that both k-2*n and k+2*n are squares.
%C When n is a prime number, a(n) is greater than all the previous terms.
%C If n = 4*x*y, then a(n) is the smallest integer solution of the form 4*(x^2 + y^2), with rational values x and y.
%H Robert Israel, <a href="/A323728/b323728.txt">Table of n, a(n) for n = 1..10000</a>
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Difference_of_two_squares">Difference of two squares</a>
%F a(n^2) = 2 * n^2.
%F a(p) = p^2 + 1, for p prime.
%F a(n) = A063655(n)^2 - 2*n.
%F a(n) = A056737(n)^2 + 2*n.
%F a(n!) = A061057(n)^2 + 2*n!.
%F a(n) = A033676(n)^2 + A033677(n)^2. - _Robert Israel_, Feb 17 2019
%F a(n) = Min_{d|n} ((n/d)^2 + d^2). - _Ridouane Oudra_, Mar 17 2024
%e For n = 3, a(3) = 10, which is the smallest integer k such that k+2*n and k-2*n are both squares: 10+2*3 = 4^2 and 10-2*3 = 2^2.
%e For n=1..10, the following {a(n)-2*n, a(n)+2*n} pairs of squares are produced: {0, 4}, {1, 9}, {4, 16}, {0, 16}, {16, 36}, {1, 25}, {36, 64}, {4, 36}, {0, 36}, {9, 49}.
%p f:= proc(n) local d;
%p d:= max(select(t -> t^2 <= n, numtheory:-divisors(n)));
%p d^2 + (n/d)^2
%p end proc:
%p map(f, [$1..100]); # _Robert Israel_, Feb 17 2019
%t Array[Block[{k = 1}, While[Nand @@ Map[IntegerQ, Sqrt[k + 2 {-#, #}]], k++]; k] &, 57] (* _Michael De Vlieger_, Feb 17 2019 *)
%o (PARI) a(n) = for(k=2*n, oo, if(issquare(k+2*n) && issquare(k-2*n), return(k)));
%o (PARI) a(n) = my(d=divisors(n)); vecmin(vector(#d, k, 4*((d[k]/2)^2 + (n/d[k]/2)^2)));
%Y Cf. A000290, A029744, A033676. A033677, A056737, A061057, A063655, A087711.
%K nonn
%O 1,1
%A _Daniel Suteu_, Jan 25 2019