A323728 a(n) is the smallest number k such that both k-2*n and k+2*n are squares.
2, 5, 10, 8, 26, 13, 50, 20, 18, 29, 122, 25, 170, 53, 34, 32, 290, 45, 362, 41, 58, 125, 530, 52, 50, 173, 90, 65, 842, 61, 962, 80, 130, 293, 74, 72, 1370, 365, 178, 89, 1682, 85, 1850, 137, 106, 533, 2210, 100, 98, 125, 298, 185, 2810, 117, 146, 113, 370
Offset: 1
Keywords
Examples
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. 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}.
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
- Wikipedia, Difference of two squares
Programs
-
Maple
f:= proc(n) local d; d:= max(select(t -> t^2 <= n, numtheory:-divisors(n))); d^2 + (n/d)^2 end proc: map(f, [$1..100]); # Robert Israel, Feb 17 2019
-
Mathematica
Array[Block[{k = 1}, While[Nand @@ Map[IntegerQ, Sqrt[k + 2 {-#, #}]], k++]; k] &, 57] (* Michael De Vlieger, Feb 17 2019 *)
-
PARI
a(n) = for(k=2*n, oo, if(issquare(k+2*n) && issquare(k-2*n), return(k)));
-
PARI
a(n) = my(d=divisors(n)); vecmin(vector(#d, k, 4*((d[k]/2)^2 + (n/d[k]/2)^2)));
Formula
a(n^2) = 2 * n^2.
a(p) = p^2 + 1, for p prime.
a(n) = A063655(n)^2 - 2*n.
a(n) = A056737(n)^2 + 2*n.
a(n!) = A061057(n)^2 + 2*n!.
a(n) = Min_{d|n} ((n/d)^2 + d^2). - Ridouane Oudra, Mar 17 2024
Comments