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 A084639 #98 Apr 25 2025 09:48:12 %S A084639 0,1,4,9,20,41,84,169,340,681,1364,2729,5460,10921,21844,43689,87380, %T A084639 174761,349524,699049,1398100,2796201,5592404,11184809,22369620, %U A084639 44739241,89478484,178956969,357913940,715827881,1431655764,2863311529,5726623060,11453246121 %N A084639 Expansion of x*(1+2*x)/((1+x)*(1-x)*(1-2*x)). %C A084639 Original name was: Generalized Jacobsthal numbers. %C A084639 This is the sequence A(0,1;1,2;3) of the family of sequences [a,b:c,d:k] considered by G. Detlefs, and treated as A(a,b;c,d;k) in the W. Lang link given below. - _Wolfdieter Lang_, Oct 18 2010 %C A084639 Entries correspond to value bound adjustment for an N-bit string having M bits set and a(n+1) bit transitions. Wolfram Alpha can easily generate an entry. a(5)=41 stems from input as 1111110_2 - 1010101_2. The subtraction pattern alternates (begins at 1), and bit count is ptr+2 both terms, with the lead term having only its LSB clear. - _Bill McEachen_, Jul 15 2011 %C A084639 Also a(n) = 2*A000975(n) if n even, a(n) = 2*A000975(n) - 1 if n odd. - _Michel Lagneau_, Jan 11 2012 %C A084639 In the above comment by Bill McEachen the binary pattern (in an obvious notation) is for even n 1^(n+1)0 - (10)^((n+2)/2) and for odd n 1^(n+1)0 - (10)^((n+1)/2)1. That is for even n a(n) = sum(2^k, k=1..(n+1)) - sum(2^(2*k-1), k=1..(n+2)/2) = (2^(n+2) - 4)/3, and for odd n a(n) = sum(2^k , k=1..(n+1)) - sum(2^(2*k), k=0..(n+1)/2) = (2^(n+2) - 5)/3. This checks with the formula a(n) = (2^(n+3) + (-1)^n - 9)/6 given below. After a correspondence with Bill McEachen. - _Wolfdieter Lang_, Jan 24 2014 %C A084639 _Michel Lagneau_'s comment above is equal to the fact that a(n) = A000975(n)-1, or in other words, this sequence gives the partial sums of Jacobsthal sequence, starting from its second 1, A001045(2). From this also follows that this sequence gives the positions of repunits in "Jacobsthal greedy base", A265747. - _Antti Karttunen_, Dec 17 2015 %C A084639 From _Kensuke Matsuoka_, Aug 11 2020: (Start) %C A084639 This sequence is the sum of diagonally arranged powers of 2 repeated in an L shape. For example, a(1)=1, a(2) = 4, a(3)=9, a(4)= 20, a(5)=41, a(6)=84 are obtained from the figure below. %C A084639 32 %C A084639 16 8 %C A084639 8 4 2 %C A084639 4 2 1 2 %C A084639 2 1 2 4 8 %C A084639 1 2 4 8 16 32 %C A084639 From this figure, a(n) = a(n-2) + 2^n is obtained. (End) %C A084639 For n > 0, also the total distance that the disks travel from the leftmost peg to the middle peg in the Tower of Hanoi puzzle, in the unique solution with 2^n - 1 moves (see links). - _Sela Fried_, Dec 17 2023 %H A084639 Vincenzo Librandi, <a href="/A084639/b084639.txt">Table of n, a(n) for n = 0..1000</a> %H A084639 Sela Fried, <a href="/A026644/a026644_1.pdf">Economically solving the Tower of Hanoi puzzle</a>. %H A084639 A. F. Horadam, <a href="https://web.archive.org/web/2024*/https://www.fq.math.ca/Scanned/34-1/horadam2.pdf">Jacobsthal Representation Numbers</a>, Fib Quart. 34, 40-54, 1996. %H A084639 Wolfdieter Lang, <a href="/A084639/a084639.pdf">Notes on certain inhomogeneous three term recurrences.</a> %H A084639 El-Mehdi Mehiri, Saad Mneimneh, and Hacène Belbachir, <a href="https://arxiv.org/abs/2502.11045">The Towers of Fibonacci, Lucas, Pell, and Jacobsthal</a>, arXiv:2502.11045 [math.CO], 2025. See p. 12. %H A084639 <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (2,1,-2). %F A084639 G.f.: x*(1+2*x)/((1+x)*(1-x)*(1-2*x)). %F A084639 E.g.f.: 4*exp(2*x)/3-3*exp(x)/2+exp(-x)/6. %F A084639 a(n) = a(n-1)+2*a(n-2)+3, a(0)=0, a(1)=1. %F A084639 a(n) = 2^(n+2)/3+(-1)^n/6-3/2. %F A084639 a(n) = A001045(n+2) - A000034(n). %F A084639 a(n) = 5*a(n-2)-4*a(n-4). Cf. A084640, A101622. - _Paul Curtz_, Apr 03 2008 %F A084639 a(n) = 2*a(n-1) + a(n-2) -2*a(n-3). - _R. J. Mathar_, Jun 28 2010 %F A084639 a(n) = a(n-1)+2*a(n-2)+3, n>1. - _Gary Detlefs_, Dec 19 2010 %F A084639 a(n) = 3*a(n-1)-2*a(n-2) +(-1)^n, n>1. - _Gary Detlefs_, Dec 19 2010 %F A084639 a(n) = a(n-2) + 2^n for n >= 2. - _Kensuke Matsuoka_, Aug 11 2020 %p A084639 a:=proc(n) (2^(n+3) + (-1)^n - 9)/6 end proc: [seq(a(n), n=0..33)]; # _Wolfdieter Lang_, Jan 24 2014 %t A084639 a[0] = 0; a[1] = 1; a[n_] := a[n] = a[n - 1] + 2 a[n - 2] + 3; Array[a, 32, 0] (* Or *) %t A084639 a[0] = 0; a[1] = 1; a[n_] := a[n] = 3 a[n - 1] - 2 a[n - 2] + (-1)^n; Array[a, 32, 0] %t A084639 CoefficientList[Series[x*(1+2*x)/((1+x)*(1-x)*(1-2*x)),{x,0,40}],x] (* or *) LinearRecurrence[{2,1,-2},{0,1,4},40] (* _Vladimir Joseph Stephan Orlovsky_, Jan 30 2012 *) %o A084639 (Magma) [2^(n+2)/3+(-1)^n/6-3/2: n in [0..35]]; // _Vincenzo Librandi_, Aug 08 2011 %o A084639 (PARI) a(n)=2^(n+2)/3-if(n%2,5,4)/3 \\ _Charles R Greathouse IV_, Aug 08 2011 %o A084639 (PARI) concat(0, Vec(x*(1+2*x)/((1+x)*(1-x)*(1-2*x)) + O(x^100))) \\ _Altug Alkan_, Dec 17 2015 %o A084639 (Python) %o A084639 def A084639(n): return (4<<n|1)//3-1-(n&1) # _Chai Wah Wu_, Apr 25 2025 %Y A084639 Cf. A000975, A000225, A001045. %Y A084639 Cf. A265747. %K A084639 easy,nonn %O A084639 0,3 %A A084639 _Paul Barry_, Jun 06 2003 %E A084639 Replaced duplicate of a formula by another recurrence - _R. J. Mathar_, Jun 28 2010