login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A321704 Number of words w of length n over an n-ary alphabet such that for every prefix z of w we have #(z,a_i) = 0 or #(z,a_i) >= #(z,a_j) for all j>i and #(z,a_i) counts the occurrences of the i-th letter in z. 1
1, 1, 4, 18, 118, 895, 8151, 83916, 977026, 12602451, 178880725, 2766415036, 46314488705, 834067614601, 16074694453741, 330017679352180, 7188779521480810 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,3

LINKS

Table of n, a(n) for n=0..16.

FORMULA

a(n) = A213276(n,n).

EXAMPLE

a(3) = 18: aaa, aab, aac, aba, abc, aca, acb, baa, bac, bbb, bbc, bca, bcb, caa, cab, cba, cbb, ccc.

MAPLE

h:= proc(n, k, m, l) option remember;

      `if`(n=0 and k=0, b(l), `if`(k=0 or n>0 and n<m, 0,

       add(h(n-j, k-1, max(m, j), [j, l[]]), j=max(1, m)..n)

          +h(n, k-1, m, [0, l[]], [])))

    end:

b:= proc(l) option remember;

      `if`({l[]} minus {0}={}, 1, add(`if`(g(l, i),

       b(subsop(i=l[i]-1, l)), 0), i=1..nops(l)))

    end:

g:= proc(l, i) local j;

      if l[i]<1     then return false

    elif l[i]>1     then for j from i+1 to nops(l) do

      if l[i]<=l[j] then return false

    elif l[j]>0     then break

      fi od fi; true

    end:

a:= n-> h(n$2, 0, []):

seq(a(n), n=0..10);  # Alois P. Heinz, Mar 29 2020

CROSSREFS

Main diagonal of A213276.

Sequence in context: A278994 A223008 A162224 * A296982 A222375 A053529

Adjacent sequences:  A321701 A321702 A321703 * A321705 A321706 A321707

KEYWORD

nonn,more

AUTHOR

Alois P. Heinz, Nov 17 2018

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 16 06:18 EDT 2021. Contains 347469 sequences. (Running on oeis4.)