OFFSET
0,3
COMMENTS
a(n)/n^n is the expected value of the number of such elements which approaches n/e as n gets large.
a(n) = Sum_{k=1..n} A219859(n,k)*k.
a(n-1) is the number of length-n words of n-1 letters where adjacent letters are distinct, see example. - Joerg Arndt, Jun 10 2013
FORMULA
a(n) = n*(n - 1)^n.
EXAMPLE
From Joerg Arndt, Jun 10 2013: (Start)
There are a(4-1)=a(3)=24 length-4 words of 3 letters (0,1,2) where adjacent letters are distinct:
01: [ 0 1 0 1 ]
02: [ 0 1 0 2 ]
03: [ 0 1 2 0 ]
04: [ 0 1 2 1 ]
05: [ 0 2 0 1 ]
06: [ 0 2 0 2 ]
07: [ 0 2 1 0 ]
08: [ 0 2 1 2 ]
09: [ 1 0 1 0 ]
10: [ 1 0 1 2 ]
11: [ 1 0 2 0 ]
12: [ 1 0 2 1 ]
13: [ 1 2 0 1 ]
14: [ 1 2 0 2 ]
15: [ 1 2 1 0 ]
16: [ 1 2 1 2 ]
17: [ 2 0 1 0 ]
18: [ 2 0 1 2 ]
19: [ 2 0 2 0 ]
20: [ 2 0 2 1 ]
21: [ 2 1 0 1 ]
22: [ 2 1 0 2 ]
23: [ 2 1 2 0 ]
24: [ 2 1 2 1 ]
(End)
MATHEMATICA
Table[n (n-1)^n, {n, 0, 20}]
PROG
(PARI) a(n) = n*(n-1)^n; \\ Michel Marcus, Aug 22 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Geoffrey Critzer, Jan 16 2013
STATUS
approved