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.

A056008 Difference between (smallest square strictly greater than 2^n) and 2^n.

This page as a plain text file.
%I A056008 #33 Apr 28 2023 15:53:30
%S A056008 3,2,5,1,9,4,17,16,33,17,65,68,129,89,257,356,513,697,1025,1337,2049,
%T A056008 2449,4097,4001,8193,4417,16385,17668,32769,24329,65537,4633,131073,
%U A056008 18532,262145,74128,524289,296512,1048577,1186048,2097153,1778369
%N A056008 Difference between (smallest square strictly greater than 2^n) and 2^n.
%C A056008 If n is even, a(n) = 2*2^(n/2) + 1, since 2^n = (2^(n/2))^2, and  a(n) = (2^(n/2) + 1)^2 - (2^(n/2))^2 = 2*2^(n/2) + 1. - _Jean-Marc Rebert_, Mar 02 2016
%C A056008 If n is odd, a(n) = 4*a(n-2) or 4*a(n-2) - 4*sqrt(a(n-2) + 2^(n-2)) + 1. - _Robert Israel_, Mar 02 2016
%H A056008 Harvey P. Dale, <a href="/A056008/b056008.txt">Table of n, a(n) for n = 0..1000</a>
%F A056008 a(n) = (floor(2^(n/2))+1)^2 - 2^n = (A017910(n)+1)^2 - A000079(n). - _Vladeta Jovovic_, May 01 2003
%F A056008 a(2k) = 2*2^k + 1 = 2*a(2(k-1)) - 1. - _Jean-Marc Rebert_, Mar 02 2016
%e A056008 a(5)=6^2-2^5=4; a(6)=9^2-2^6=17
%p A056008 f:= proc(n) local m;
%p A056008    if n::even then m:= 2*2^(n/2)+1
%p A056008    else m:= ceil(sqrt(2)*2^((n-1)/2))
%p A056008    fi;
%p A056008    m^2-2^n
%p A056008 end proc:
%p A056008 map(f, [$0..100]); # _Robert Israel_, Mar 02 2016
%t A056008 ssg[n_]:=Module[{s=2^n},(1+Floor[Sqrt[s]])^2-s]; Array[ssg,50,0] (* _Harvey P. Dale_, Aug 22 2015 *)
%t A056008 Table[((Floor[2^(n/2)] + 1)^2 - 2^n), {n, 0, 50}] (* _Vincenzo Librandi_, Mar 03 2016 *)
%o A056008 (Magma) [(Floor(2^(n/2))+1)^2-2^n : n in [0..50]]; // _Vincenzo Librandi_, Mar 03 2016
%o A056008 (Python)
%o A056008 from math import isqrt
%o A056008 def A056008(n): return (isqrt(m:=1<<n)+1)**2-m # _Chai Wah Wu_, Apr 28 2023
%Y A056008 Bisections: A000051, A238454.
%Y A056008 Cf. A000079, A017910.
%Y A056008 Cf. A051204, A056007.
%K A056008 nonn
%O A056008 0,1
%A A056008 _Henry Bottomley_, Jul 24 2000