A111066 Numbers with digits 1 and 2 and at least one of each.
12, 21, 112, 121, 122, 211, 212, 221, 1112, 1121, 1122, 1211, 1212, 1221, 1222, 2111, 2112, 2121, 2122, 2211, 2212, 2221, 11112, 11121, 11122, 11211, 11212, 11221, 11222, 12111, 12112, 12121, 12122, 12211, 12212, 12221, 12222, 21111, 21112, 21121, 21122, 21211
Offset: 1
Links
- Harvey P. Dale, Table of n, a(n) for n = 1..1000
Crossrefs
Programs
-
Mathematica
FromDigits /@ Select[ IntegerDigits[ Range[210], 3], Union[ # ] == {1, 2} &] (* Robert G. Wilson v, Oct 09 2005 *) Union[FromDigits/@Select[Flatten[Table[Tuples[{1,2},n],{n,2,5}],1], Union[#] == {1,2}&]] (* Harvey P. Dale, Sep 05 2013 *)
-
Python
from itertools import count, islice def agen(): for i in count(1): s = bin(i+1)[3:].replace('1', '2').replace('0', '1') if 0 < s.count('1') < len(s): yield int(s) print(list(islice(agen(), 42))) # Michael S. Branicky, Dec 21 2021
Extensions
More terms from Robert G. Wilson v, Oct 09 2005
Crossrefs from Charles R Greathouse IV, Aug 03 2010