[spoiler]
package test;
public class Tester {
static int count = 0;
/**
* @param args
*/
public static void main(String[] args) {
Boolean[] fw = new Boolean[100];
for (int i = 0; i < fw.length; i++) {
fw[i]=false;
}
prog(fw);
int menge = 0;
for (int i = 0; i < fw.length; i++) {
if(fw[i]==true){
System.out.println((i+1)+" forwarded");
menge++;
}
}
System.out.println(menge);
}
private static void prog(Boolean[] fw) {
count++;
System.out.println("prog "+count+":");
for (int i = (count-1); i < fw.length; i = (i + count)) {
if (fw[i] == false) {
fw[i] = true;
System.out.println("false to true "+(i+1));
} else if (fw[i] == true) {
fw[i] = false;
System.out.println("true to false "+(i+1));
}
}
System.out.println("---------");
if (count == 100) {
return;
} else {
prog(fw);
}
}
}
[/spoiler]
That really called for recursion


,
,
,
,
,
or >:D are attached, that paragraph may not be 100% serious. Seriously.




