As discussed in Ideas:
In an attempt to understand the nature of permutations, found all the permutations of a four-digit binary number (0001,0010, etc). Noticed that if you tally the number of times a given number of 1's appeared for each permutation, you would get a much higher occurrence of two 1's than four or zero 1's. Also found that if you graph these tallies, the results had a bell shape. Wrote a a program that does this tallying for a much longer binary number and found similar results. Hypothesized that if you were to take the limit as the length of the permuted binary number approached infinity, would get a perfect normal distribution curve.read more
I ended up creating code that would print out code that I could use to approach this limit.
Sample output:
bbbbbbbbbbabbaab
bbbbbbbbbbabbaba
bbbbbbbbbbabbabb
bbbbbbbbbbabbbaa
bbbbbbbbbbabbbab
bbbbbbbbbbabbbba
bbbbbbbbbbabbbbb
bbbbbbbbbbbaaaaa
bbbbbbbbbbbaaaab
bbbbbbbbbbbaaaba
bbbbbbbbbbbaaabb
bbbbbbbbbbbaabaa
bbbbbbbbbbbaabab
bbbbbbbbbbbaabba
bbbbbbbbbbbaabbb
bbbbbbbbbbbabaaa
bbbbbbbbbbbabaab
bbbbbbbbbbbababa
bbbbbbbbbbbababb
bbbbbbbbbbbabbaa
bbbbbbbbbbbabbab
bbbbbbbbbbbabbba
bbbbbbbbbbbabbbb
bbbbbbbbbbbbaaaa
bbbbbbbbbbbbaaab
bbbbbbbbbbbbaaba
bbbbbbbbbbbbaabb
bbbbbbbbbbbbabaa
bbbbbbbbbbbbabab
bbbbbbbbbbbbabba
bbbbbbbbbbbbabbb
bbbbbbbbbbbbbaaa
bbbbbbbbbbbbbaab
bbbbbbbbbbbbbaba
bbbbbbbbbbbbbabb
bbbbbbbbbbbbbbaa
bbbbbbbbbbbbbbab
bbbbbbbbbbbbbbba
bbbbbbbbbbbbbbbb
1
16
120
560
1820
4368
8008
11440
12870
11440
8008
4368
1820
560
120
16
1
1
16
120
560
1820
4368
8008
11440
12870
11440
8008
4368
1820
560
120
16
1
normalDistrobutionCurveCodeCreator.java
public class normalDistrobutionCurveCodeCreator {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
//The limit is 16
int lengthOf = 16;
final int lengthOfStat = lengthOf;
int orientationsOf = 2;
int incrementor = lengthOf;
int incrementor2 = lengthOf;
int incrementor3 = (lengthOf - 1);
int counter = 1;
String a = "a";
String b = "b";
for (int i = 'j'; i < 'z'; i++) {
if (incrementor2 > 0) {
System.out.println("boolean " + (char) i + " = false;");
incrementor2--;
}
}
for (int i = 0; i < lengthOf+1; i++) {
System.out.println("int vara" + i + "=0;");
}
for (int i = 0; i < lengthOf+1; i++) {
System.out.println("int varb" + i + "=0;");
}
System.out.println("int length = " + lengthOf + ";");
System.out.println("int temp = 0;int tempa= 0;int tempb= 0;");
System.out.println("String[] matrix = new String[" + lengthOf + "];");
System.out.println("int orientations = " + orientationsOf + ";");
System.out.println("String a = \"a\";");
System.out
.println("String b = \"b\";int[] distributiona = new int[(int) Math.pow(orientations,length)];int[] distributionb = new int[(int) Math.pow(orientations,length)];");
System.out.println("for (int i = 0; i < Math.pow(" + orientationsOf
+ ", " + lengthOf + "); i++) {");
while (lengthOf > 0) {
for (int i = 'j'; i < 'z'; i++) {
if (incrementor > 0) {
System.out.println("if (i % Math.pow(" + orientationsOf
+ ", " + incrementor3 + ") == 0) {" + (char) i
+ " = !" + (char) i + ";}");
System.out.println("if (" + (char) i
+ ") {matrix[length - " + counter + "] = a;}");
System.out.println("else {matrix[length - " + counter
+ "] = b;}");
incrementor--;
incrementor3--;
counter++;
}
}
lengthOf--;
}
System.out.println("temp = length;tempa = 0;tempb = 0;");
System.out
.println("while (temp > 0) {System.out.print(matrix[temp - 1]);if(matrix[temp -1]==a){ tempa++; }if(matrix[temp -1]==b){ tempb++;}temp--;}distributiona[i]=tempa;distributionb[i]=tempb;System.out.println();}");
System.out
.println("for (int i = ((int) Math.pow(orientations, length)-1); i > -1 ; i--) {");
for(int i = 0; i < lengthOfStat+1; i++){
System.out.println("if(distributiona[i]=="+i+") {vara"+i+"++;}");
}
for(int i = 0; i < lengthOfStat+1; i++){
System.out.println("if(distributionb[i]=="+i+") {varb"+i+"++;}");
}
System.out.println("}");
for(int i = 0; i < lengthOfStat+1; i++){
System.out.println("System.out.println(vara"+i+");");
}
for(int i = 0; i < lengthOfStat+1; i++){
System.out.println("System.out.println(varb"+i+");");
}
}
}