A126393 Number of base 6 n-digit numbers with adjacent digits differing by two or less.
1, 6, 24, 100, 418, 1748, 7310, 30570, 127842, 534628, 2235784, 9349922, 39100844, 163517514, 683820978, 2859700582, 11959105792, 50012302772, 209148616298, 874647662172, 3657726962214, 15296406894730, 63968706878962
Offset: 0
Links
- G. C. Greubel, Table of n, a(n) for n = 0..1000
- Sergey Kitaev and Jeffrey Remmel, (a,b)-rectangle patterns in permutations and words, arXiv:1304.4286 [math.CO], 2013.
- Index entries for linear recurrences with constant coefficients, signature (4,1,-1).
Programs
-
Magma
I:=[1,6,24,100]; [n le 4 select I[n] else 4*Self(n-1) +Self(n-2) -Self(n-3): n in [1..41]]; // G. C. Greubel, Aug 08 2023
-
Mathematica
LinearRecurrence[{4,1,-1}, {1,6,24,100}, 41] (* G. C. Greubel, Aug 08 2023 *)
-
SageMath
@CachedFunction def a(n): # A126393 if (n<4): return (1,6,24,100)[n] else: return 4*a(n-1) +a(n-2) -a(n-3) [a(n) for n in range(41)] # G. C. Greubel, Aug 08 2023
Formula
G.f.: 1 + 2*x*(3-x^2)/(1-4*x-x^2+x^3). - R. J. Mathar, Jun 06 2013
Comments