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.

A079360 Sequence of sums of alternating increasing powers of 2.

This page as a plain text file.
%I A079360 #26 Sep 23 2022 16:32:25
%S A079360 1,5,7,15,19,35,43,75,91,155,187,315,379,635,763,1275,1531,2555,3067,
%T A079360 5115,6139,10235,12283,20475,24571,40955,49147,81915,98299,163835,
%U A079360 196603,327675,393211,655355,786427,1310715,1572859,2621435,3145723
%N A079360 Sequence of sums of alternating increasing powers of 2.
%C A079360 Found as a question on http://mail.python.org/mailman/listinfo/tutor poster: reavey.
%H A079360 G. C. Greubel, <a href="/A079360/b079360.txt">Table of n, a(n) for n = 0..5000</a>
%H A079360 Tutor User "reavey" (reavey@nep.net) and others, <a href="https://mail.python.org/pipermail/tutor/2003-February/thread.html#20681">How to write an algorithm for sequence</a>, Tutor -- Discussion for learning programming with Python, 2003.
%H A079360 <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (1,2,-2).
%F A079360 a(2n) = 6*2^n - 5, a(2n-1) = 5*(2^n - 1). - _Benoit Cloitre_, Feb 16 2003
%F A079360 From _Colin Barker_, Sep 19 2012: (Start)
%F A079360 a(n) = a(n-1) + 2*a(n-2) - 2*a(n-3).
%F A079360 G.f.: (1+4*x)/((1-x)*(1-2*x^2)). (End)
%p A079360 seq(coeff(series((1+4*x)/((1-x)*(1-2*x^2)), x, n+1), x, n), n = 0..40); # _G. C. Greubel_, Aug 07 2019
%t A079360 LinearRecurrence[{1,2,-2}, {1,5,7}, 40] (* _G. C. Greubel_, Aug 07 2019 *)
%o A079360 (PARI) seq(n) = { j=a=1; p=2; print1(1" "); while(j<=n, a = a + 2^p; print1(a" "); a = a+2^(p-1); print1(a" "); p+=1; j+=2; ) }
%o A079360 (PARI) a(n)=if(n<0,0,(6-n%2)*2^ceil(n/2)-5)
%o A079360 (Magma) I:=[1,5,7]; [n le 3 select I[n] else Self(n-1) +2*Self(n-2) -2*Self(n-3): n in [1..40]]; // _G. C. Greubel_, Aug 07 2019
%o A079360 (Sage)
%o A079360 @CachedFunction
%o A079360 def a(n):
%o A079360     if (n==0): return 1
%o A079360     elif (1<=n<=2): return nth_prime(n+2)
%o A079360     else: return a(n-1) + 2*a(n-2) - 2*a(n-3)
%o A079360 [a(n) for n in (0..40)] # _G. C. Greubel_, Aug 07 2019
%o A079360 (GAP) a:=[1,5,7];; for n in [4..30] do a[n]:=a[n-1]+2*a[n-2]-2*a[n-3]; od; a; # _G. C. Greubel_, Aug 07 2019
%Y A079360 Cf. A079361, A079362, A048488 (bisection).
%K A079360 easy,nonn
%O A079360 0,2
%A A079360 _Cino Hilliard_, Feb 15 2003