Created
November 27, 2011 21:38
-
-
Save jakedobkin/1398194 to your computer and use it in GitHub Desktop.
Euler 24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/local/bin/node | |
| count = 0; | |
| permutations = new Array(); | |
| while(count <= 1000000) { | |
| for(a=0;a<=9;a++){ | |
| for(b=0;b<=9;b++){ | |
| for(c=0;c<=9;c++){ | |
| for(d=0;d<=9;d++){ | |
| for(e=0;e<=9;e++){ | |
| for(f=0;f<=9;f++){ | |
| for(g=0;g<=9;g++){ | |
| for(h=0;h<=9;h++){ | |
| for(i=0;i<=9;i++){ | |
| for(j=0;j<=9;j++){ | |
| if ((a!=b) && (a!=c) && (a!=d) && (a!=e) && (a!=f) && (a!=g) && (a!=h) && (a!=i) && (a!=j) && (b!=c) && (b!=d) && (b!=e) && (b!=f) && (b!=g) && (b!=h) && (b!=i) && (b!=j) && (c!=d) && (c!=e) && (c!=f) && (c!=g) && (c!=h) && (c!=i) && (c!=j) && (d!=e) && (d!=f) && (d!=g) && (d!=h) && (d!=i) && (d!=j) && (e!=f) && (e!=g) && (e!=h) && (e!=i) && (e!=j) && (f!=g) && (f!=h) && (f!=i) && (f!=j) && (g!=h) && (g!=i) && (g!=j) && (h!=i) && (h!=j) && (i!=j)) | |
| { | |
| if (count == 999999) | |
| { | |
| console.log("this is the millionth permutation:"); | |
| console.log(a+""+b+""+c+""+d+""+e+""+f+""+g+""+h+""+i+""+j); | |
| } | |
| count +=1; | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OK, final edit