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.

A256243 Smallest positive integer m such that n + 2m is a square.

This page as a plain text file.
%I A256243 #18 Oct 14 2020 16:43:22
%S A256243 4,1,3,6,2,5,1,4,8,3,7,2,6,1,5,10,4,9,3,8,2,7,1,6,12,5,11,4,10,3,9,2,
%T A256243 8,1,7,14,6,13,5,12,4,11,3,10,2,9,1,8,16,7,15,6,14,5,13,4,12,3,11,2,
%U A256243 10,1,9,18,8,17,7,16,6,15,5,14,4,13,3,12,2,11,1,10,20,9,19,8,18,7,17,6,16,5,15,4,14,3,13,2,12,1,11,22
%N A256243 Smallest positive integer m such that n + 2m is a square.
%H A256243 Charles R Greathouse IV, <a href="/A256243/b256243.txt">Table of n, a(n) for n = 1..10000</a>
%F A256243 1 <= a(n) <= 2*sqrt(n) + 2. - _Charles R Greathouse IV_, Mar 23 2015
%F A256243 a(n) = (1/4)*(6*floor(sqrt(n)) + 2*floor(sqrt(n))^2 + (2*floor(sqrt(n)) + 3)*(-1)^(n - floor(sqrt(n))) - 2*n + 5). - _Ridouane Oudra_, Oct 09 2020
%e A256243 1 + 2*4 = 9 = 3^2 so a(1) = 4.
%e A256243 2 + 2*1 = 4 = 2^2, so a(2) = 1.
%e A256243 3 + 2*3 = 9 = 3^2, so a(3) = 3.
%t A256243 Table[m = 1; While[! IntegerQ[Sqrt[n + 2*m]], m++]; m, {n, 100}] (* _Michael De Vlieger_, Mar 20 2015 *)
%o A256243 (PARI) a(n)=m=1;while(!issquare(n+2*m),m++);m
%o A256243 vector(100,n,a(n)) \\ _Derek Orr_, Mar 22 2015
%o A256243 (PARI) a(n)=my(s=sqrtint(n)); (if((s-n)%2,s+1,s+2)^2-n)/2 \\ _Charles R Greathouse IV_, Mar 23 2015
%Y A256243 Cf. A256244, A080883.
%K A256243 nonn,easy
%O A256243 1,1
%A A256243 _Zak Seidov_, Mar 20 2015