Is there a quick and dirty way to generate a list of numbers from 1 to some arbitrary large number in order such that the digits of each number are only 0's, 1's, and 2's?
I tried doing
n = {0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2};
v =
Sort @ Rest @
DeleteDuplicates[
FromDigits /@ (Cases[
Permutations /@
Rest @ DeleteDuplicates @
Subsets[n], {x__?(Head[#] =!= List &)} :> {x}, -1])];
but it slows down pretty fast, so I don't think I can add any more entries to n.
(Also, still not sure how to copy-paste Mathematica code in here so it looks exactly like it does in Mathematica)
InputForm, it looks like you copiedTeXFormorTraditionalForminstead. – 2012rcampion Mar 21 '15 at 02:19FromDigits /@ IntegerDigits[Range[1000], 3]? – kglr Mar 21 '15 at 02:26