A214218 List of words over {1,2} with equal numbers of 1's and 2's.
12, 21, 1122, 1212, 1221, 2112, 2121, 2211, 111222, 112122, 112212, 112221, 121122, 121212, 121221, 122112, 122121, 122211, 211122, 211212, 211221, 212112, 212121, 212211, 221112, 221121, 221211, 222111, 11112222, 11121222, 11122122, 11122212, 11122221
Offset: 1
References
- J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 2.
Links
- Harvey P. Dale, Table of n, a(n) for n = 1..1000
Programs
-
Maple
sort([seq(seq((10^(2*d)-1)/9+add(10^i,i=s),s=combinat:-choose([$0..(2*d-1)],d)),d=1..4)]); # Robert Israel, Jan 02 2018
-
Mathematica
Sort[FromDigits/@Flatten[Table[Permutations[PadRight[{},2n,{1,2}]],{n,3}],1]] (* Harvey P. Dale, Aug 30 2016 *)
-
Python
from itertools import count, islice from sympy.utilities.iterables import multiset_permutations as mp def agen(): for d in count(2, 2): for s in mp("1"*(d//2) + "2"*(d//2), d): yield int("".join(s)) print(list(islice(agen(), 33))) # Michael S. Branicky, Dec 21 2021
Comments