login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A277673 Number of n-length words over an n-ary alphabet {a_1,a_2,...,a_n} avoiding consecutive letters a_i, a_{i+1}. 2

%I #11 Nov 02 2021 04:35:06

%S 1,1,3,16,136,1547,22012,375231,7445184,168412696,4275561136,

%T 120338946469,3718175865856,125094920949797,4551798150123456,

%U 178094082550301368,7455514741874966528,332495821030327545527,15737024371475868676864,787813565550480151088691

%N Number of n-length words over an n-ary alphabet {a_1,a_2,...,a_n} avoiding consecutive letters a_i, a_{i+1}.

%H Alois P. Heinz, <a href="/A277673/b277673.txt">Table of n, a(n) for n = 0..386</a>

%F a(n) = [x^n] 1/(1+Sum_{j=1..n} (n+1-j)*(-x)^j).

%e a(3) = 16: 000, 002, 020, 021, 022, 100, 102, 110, 111, 200, 202, 210, 211, 220, 221, 222 (using ternary alphabet {0, 1, 2}).

%p b:= proc(n, k) option remember; `if`(n<0, 0, `if`(n=0, 1,

%p -add((-1)^j*(k+1-j)*b(n-j, k), j=1..k)))

%p end:

%p a:= n-> b(n$2):

%p seq(a(n), n=0..25);

%t b[n_, k_] := b[n, k] = If[n < 0, 0, If[n == 0, 1,

%t -Sum[(-1)^j (k+1-j) b[n-j, k], {j, 1, k}]]];

%t a[n_] := b[n, n];

%t Table[a[n], {n, 0, 25}] (* _Jean-François Alcover_, Nov 02 2021, after _Alois P. Heinz_ *)

%Y Main diagonal of A277666.

%K nonn

%O 0,3

%A _Alois P. Heinz_, Oct 26 2016

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 16 10:08 EDT 2024. Contains 371698 sequences. (Running on oeis4.)