#Java 7, <s>192</s> <s>183</s> 181 bytes class M{public static void main(String[]a){int i=1,c=0;while(!(c+"").equals(a[0]))if(!new String(new char[++i]).matches("(..+)\\1+")&(i+"").contains(a[0]))c++;System.out.print(i);}} **Ungolfed:** class M { public static void main(String[] a) { int i = 1, c = 0; while(!(c+"").equals(a[0])) { if(!new String(new char[++i]).matches("(..+)\\1+") & (i+"").contains(a[0])) { c++; } } System.out.print(i); } } **Usage:** java -jar M.jar 10 **Output:** 1033