cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A323728 a(n) is the smallest number k such that both k-2*n and k+2*n are squares.

Original entry on oeis.org

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

Views

Author

Daniel Suteu, Jan 25 2019

Keywords

Comments

When n is a prime number, a(n) is greater than all the previous terms.
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.

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}.
		

Crossrefs

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) = A033676(n)^2 + A033677(n)^2. - Robert Israel, Feb 17 2019
a(n) = Min_{d|n} ((n/d)^2 + d^2). - Ridouane Oudra, Mar 17 2024