login
A126392
Number of base 5 n-digit numbers with adjacent digits differing by two or less.
3
1, 5, 19, 75, 295, 1161, 4569, 17981, 70763, 278483, 1095951, 4313041, 16973681, 66798773, 262882051, 1034554523, 4071419319, 16022795225, 63056626377, 248155086189, 976597549531, 3843333571747, 15125179200799, 59524119253665
OFFSET
0,2
COMMENTS
a(base,n)=a(base-1,n)+5^(n-1) for base>=2n-1; a(base,n)=a(base-1,n)+5^(n-1)-2 when base=2n-2.
FORMULA
a(n) = 4*a(n-1)-a(n-3). G.f.: -(x^2-x-1)/(x^3-4*x+1). [Colin Barker, Nov 25 2012]
MATHEMATICA
LinearRecurrence[{4, 0, -1}, {1, 5, 19}, 30] (* Harvey P. Dale, Apr 27 2018 *)
PROG
(S/R) stvar $[N]:(0..M-1) init $[]:=0 asgn $[]->{*} kill +[i in 0..N-2](($[i]`-$[i+1]`>2)+($[i+1]`-$[i]`>2))
CROSSREFS
Cf. Base 5 differing by one or less A057960.
Sequence in context: A295374 A212403 A098913 * A206373 A149767 A149768
KEYWORD
nonn,base
AUTHOR
R. H. Hardin, Dec 28 2006
EXTENSIONS
Edited by Charles R Greathouse IV, Aug 05 2010
STATUS
approved