A037481 Base 4 digits are, in order, the first n terms of the periodic sequence with initial period 1,2.
0, 1, 6, 25, 102, 409, 1638, 6553, 26214, 104857, 419430, 1677721, 6710886, 26843545, 107374182, 429496729, 1717986918, 6871947673, 27487790694, 109951162777, 439804651110, 1759218604441, 7036874417766, 28147497671065
Offset: 0
References
- Martin Gardner, Colossal Book of Mathematics, Chapter 34, Bulgarian Solitaire and Other Seemingly Endless Tasks, pp. 455-467, W. W. Norton & Company, 2001.
Links
- Vincenzo Librandi, Table of n, a(n) for n = 0..1000
- Wikipedia, Bulgarian solitaire
- Index entries for linear recurrences with constant coefficients, signature (4,1,-4).
Crossrefs
Programs
-
Magma
I:=[0, 1, 6]; [n le 3 select I[n] else 4*Self(n-1)+Self(n-2)-4*Self(n-3): n in [1..30]]; // Vincenzo Librandi, Jun 21 2012
-
Mathematica
LinearRecurrence[{4,1,-4},{0,1,6},40] (* Vincenzo Librandi, Jun 21 2012 *) Module[{nn=30,ps},ps=PadRight[{},nn,{1,2}];Table[FromDigits[Take[ps,n],4],{n,0,nn}]] (* Harvey P. Dale, Jul 18 2013 *)
-
PARI
concat(0, Vec(x*(2*x+1)/((x-1)*(x+1)*(4*x-1)) + O(x^100))) \\ Colin Barker, Apr 30 2014
-
PARI
a(n) = 2<<(2*n) \ 5; \\ Kevin Ryde, Jun 24 2023
-
Python
def A037481(n): return (1<<(n<<1|1))//5 # Chai Wah Wu, Jun 28 2023
-
Scheme
(define (A037481 n) (/ (- (/ (+ (expt 4 (1+ n)) (expt -1 n)) 5) 1) 2)) ;; Using Ralf Stephan's direct formula - Antti Karttunen, Jul 12 2013
Formula
a(n) = ((4^(n+1) - (-1)^(n+1))/5 - 1)/2. - Ralf Stephan
a(n) = 4*a(n-1) + a(n-2) - 4*a(n-3). - Vincenzo Librandi, Jun 21 2012
a(n) = A226062(A129594(A227451(n))). [See page 465 in Gardner's book] - Antti Karttunen, Jul 12 2013
G.f.: x*(2*x+1) / ((x-1)*(x+1)*(4*x-1)). - Colin Barker, Apr 30 2014
Comments