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.
%I A238455 #26 Jun 16 2022 10:25:06 %S A238455 0,1,1,-2,3,-11,1,-87,-167,-306,-500,-552,688,-3041,-579,20854,37075, %T A238455 55618,37108,-222296,-147729,891994,602155,-3523022,-2228805,14811346, %U A238455 11792251,-47737262,-1136517,375078994,741065851,1445763154,2746052116,4910207464,7492827856 %N A238455 Difference between 4^n and the nearest triangular number. %H A238455 Harvey P. Dale, <a href="/A238455/b238455.txt">Table of n, a(n) for n = 0..1000</a> %F A238455 a(n) = (1/2)*(-t^2 - t + 2*4^n), where t = floor(sqrt(2*4^n)) after formula in A053616. - _Michel Marcus_, Jun 16 2022 %e A238455 a(0) = 1 - 1 = 0. %e A238455 a(1) = 4 - 3 = 1. %e A238455 a(2) = 16 - 15 = 1. %e A238455 a(3) = 64 - 66 = -2. %e A238455 a(4) = 256 - 253 = 3. %t A238455 db4n[n_]:=Module[{c=4^n,tr,t1,t2,d1,d2},tr=Floor[(Sqrt[8c+1]-1)/2];t1= (tr (tr+1))/ 2;t2=((tr+1)(tr+2))/2;d1=c-t1;d2=c-t2;If[d1<Abs[ d2], d1,d2]]; Array[ db4n,40,0] (* _Harvey P. Dale_, Jul 02 2019 *) %o A238455 (Python) %o A238455 def isqrt(a): %o A238455 sr = 1 << (int.bit_length(int(a)) >> 1) %o A238455 while a < sr*sr: sr>>=1 %o A238455 b = sr>>1 %o A238455 while b: %o A238455 s = sr + b %o A238455 if a >= s*s: sr = s %o A238455 b>>=1 %o A238455 return sr %o A238455 for n in range(77): %o A238455 nn = 4**n %o A238455 s = isqrt(2*nn) %o A238455 if s*(s+1)//2 > nn: s-=1 %o A238455 d1 = nn - s*(s+1)//2 %o A238455 d2 = (s+1)*(s+2)//2 - nn %o A238455 if d2 < d1: d1 = -d2 %o A238455 print(str(d1), end=',') %o A238455 (PARI) a(n) = my(p=4^n, t=sqrtint(2*p)); (-t^2 - t + 2*p)/2; \\ _Michel Marcus_, Jun 16 2022 %Y A238455 Absolute values give the other bisection of A233327. %Y A238455 Cf. A000079, A000217, A053616. %K A238455 sign %O A238455 0,4 %A A238455 _Alex Ratushnyak_, Feb 26 2014