login
Number of base 4 n-digit numbers with adjacent digits differing by one or less.
37

%I #42 Sep 08 2022 08:45:29

%S 1,4,10,26,68,178,466,1220,3194,8362,21892,57314,150050,392836,

%T 1028458,2692538,7049156,18454930,48315634,126491972,331160282,

%U 866988874,2269806340,5942430146,15557484098,40730022148,106632582346,279167724890,730870592324

%N Number of base 4 n-digit numbers with adjacent digits differing by one or less.

%C [Empirical] a(base,n)=a(base-1,n)+3^(n-1) for base>=n; a(base,n)=a(base-1,n)+3^(n-1)-2 when base=n-1

%C a(n) is the number of quaternary sequences of length n such that no two adjacent terms differ by exactly 1. - _David Nacin_, May 31 2017

%H Vincenzo Librandi, <a href="/A126358/b126358.txt">Table of n, a(n) for n = 0..1000</a>

%H Arnold Knopfmacher, Toufik Mansour, Augustine Munagi, Helmut Prodinger, <a href="http://arxiv.org/abs/0809.0551">Smooth words and Chebyshev polynomials</a>, arXiv:0809.0551v1 [math.CO], 2008.

%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (3,-1).

%F a(n) = 2*F(2*n+1) = A052995(n+1) for n>0, F(n)=A000045(n) and a(0)=1. - _Mircea Merca_, Jun 28 2012

%F G.f.: (1+x-x^2)/(1-3*x+x^2). - _Bruno Berselli_, Jun 28 2012

%F From _David Nacin_, May 31 2017: (Start)

%F For n>2, a(n) = 3*a(n-1)-a(n-2), a(0)=1, a(1)=4, a(2)=10.

%F For n>0, a(n) = (1-1/sqrt(5))(3/2-sqrt(5)/2)^n + (1+1/sqrt(5))(3/2+sqrt(5)/2)^n. (End)

%t Join[{1}, Table[2*Fibonacci[2*n+1],{n,1,1001}]] (* _Vincenzo Librandi_, Jun 28 2012 *)

%o (S/R) stvar $[N]:(0..M-1) init $[]:=0 asgn $[]->{*} kill +[i in 0..N-2](($[i]`-$[i+1]`>1)+($[i+1]`-$[i]`>1))

%o (Magma) [1] cat [(2*Fibonacci(2*n+1)): n in [1..30]]; // _Vincenzo Librandi_, Jun 28 2012

%K nonn,base,easy

%O 0,2

%A _R. H. Hardin_, Dec 26 2006