A124697 Number of base 4 circular n-digit numbers with adjacent digits differing by 1 or less.
1, 4, 10, 22, 54, 134, 340, 872, 2254, 5854, 15250, 39802, 104004, 271964, 711490, 1861862, 4873054, 12755614, 33391060, 87413152, 228841254, 599099054, 1568437210, 4106182322, 10750060804, 28143920884, 73681573690, 192900592822, 505019869254, 1322158472054
Offset: 0
Links
- Colin Barker, Table of n, a(n) for n = 0..1000
- OEIS Wiki, Number of base k circular n-digit numbers with adjacent digits differing by d or less
- Index entries for linear recurrences with constant coefficients, signature (4,-3,-2,1).
Programs
-
Mathematica
LinearRecurrence[{4,-3,-2,1},{1,4,10,22,54},30] (* Harvey P. Dale, Oct 14 2016 *)
-
PARI
Vec(-(3*x^4-4*x^3-3*x^2+1)/((x^2-3*x+1)*(x^2+x-1)) + O(x^40)) \\ Colin Barker, Jul 19 2015
Formula
G.f.: A(x) = (3*x^4-4*x^3-3*x^2+1) / ((x^2-3*x+1)*(1-x-x^2)). - Colin Barker, Jul 19 2015
From Peter Bala, Nov 08 2022: (Start)
A(x) = 1 + x*B'(x)/B(x), where B(x) = 1/((1 - x - x^2)*(1 - 3*x + x^2)) = 1 + 4*x + 13*x^2 + 38*x^3 + ... has integral coefficients. See A056014.
It follows that the Gauss congruences hold: a(n*p^r) == a(n*p^(r-1)) (mod p^r) for all primes p and positive integers n and r. (End)
Comments