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!)
A192296 Number of ternary words of length 2n obtained by self-shuffling. 2
1, 3, 15, 93, 621, 4425, 32703, 248901, 1934007, 15285771, 122437215, 991731999, 8107830597 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,2

COMMENTS

See A191755 for the number of binary words of length 2n obtained by self-shuffling and also for an explanation of "self-shuffling" and a reference.

LINKS

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

N. Rampersad and J. Shallit, Shuffling and unshuffling, preprint, arXiv:1106.5767 [cs.FL], 2011.

EXAMPLE

a(2) = 15 because {0,0,0,0}, {0,0,1,1}, {0,0,2,2}, {0,1,0,1}, {0,2,0,2}, {1,0,1,0}, {1,1,0,0}, {1,1,1,1}, {1,1,2,2}, {1,2,1,2}, {2,0,2,0}, {2,1,2,1}, {2,2,0,0}, {2,2,1,1}, {2,2,2,2} (and no other ternary words of length 4) are generated by self-shuffling.

PROG

(Python)

from itertools import product, combinations

def a(n):

  if n<=1: return 3**n

  range2n, set2n = list(range(2*n)), set(range(2*n))

  allset, ssw = set(), [0 for i in range(2*n)]

  for w in product("012", repeat=n-1):

    w = "0" + "".join(w)

    if w.count("1") > w.count("2"): continue

    for s in combinations(range2n, n):

      nots = sorted(set2n-set(s))

      for i, c in enumerate(w): ssw[s[i]] = ssw[nots[i]] = c

      allset.add("".join(ssw))

  num2g1 = sum(w.count("1") < w.count("2") for w in allset)

  return 3*(len(allset) + num2g1)

print([a(n) for n in range(8)]) # Michael S. Branicky, Jan 03 2021

CROSSREFS

Cf. A191755.

Sequence in context: A231657 A303558 A193661 * A002893 A256335 A258313

Adjacent sequences:  A192293 A192294 A192295 * A192297 A192298 A192299

KEYWORD

nonn,more

AUTHOR

John W. Layman, Jun 27 2011

EXTENSIONS

a(8)-a(9) from Alois P. Heinz, Sep 26 2011

a(10)-a(12) from Bert Dobbelaere, Oct 02 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 October 21 15:46 EDT 2021. Contains 348155 sequences. (Running on oeis4.)