--- /dev/null
+<?php\r
+$start = 0;\r
+$stop = 9999;\r
+$length = 4;\r
+\r
+$rada = "";\r
+$notfoundlast = -3;\r
+$error = 1;\r
+\r
+while($error) {\r
+\r
+for($i=$start;$i<=$stop;$i++) {\r
+ //$i = base_convert($i, 10, 2);\r
+ if(strpos($rada, $i) == 0) {\r
+ $rada = "$rada"."$i";\r
+ //echo($i);\r
+ }\r
+}\r
+\r
+for($i=0;$i<(strlen($rada)-$length);$i++) {\r
+ $sub = substr($rada, $i, $length);\r
+ for($x=0;$x<$length;$x++) {\r
+ $rada[($i+$x)] = "R";\r
+ \r
+ }\r
+ $rada = str_replace($sub, "", $rada);\r
+ \r
+ $replace="";\r
+ for($x=0;$x<$length;$x++) {\r
+ $replace = $replace."R";\r
+ }\r
+ \r
+ $rada = str_replace($replace, $sub, $rada);\r
+}\r
+\r
+//echo($rada);\r
+\r
+//Test\r
+//echo("\n\n");\r
+$error = 0;\r
+$notfound = 0;\r
+for($i=$start;$i<=$stop;$i++) {\r
+ if(!eregi($i, $rada)) {\r
+ //echo("Not found: $i\n");\r
+ $rada = $rada.$i;\r
+ $error = 1;\r
+ $notfound++;\r
+ }\r
+}\r
+echo("Not found total: $notfound\n");\r
+if($notfoundlast == $notfound) { $error = 0; }\r
+$notfoundlast = $notfound;\r
+}\r
+\r
+for($i=$start;$i<=$stop;$i++) {\r
+ if(!eregi($i, $rada)) {\r
+ $rada = $rada.$i;\r
+ }\r
+}\r
+\r
+echo("\n\n".$rada);\r
+//system("pause");\r