<html>
<head>
<script type="text/javascript">
zahlen = new Array();
zahlen.push("3");
zahlen.push("2");
zahlen.push("4");
zahlen.push("11");
zahlen.push("8");
zahlen.push("7");
maxworth = 15;
erg = new Array();
stillhad = new Array();
for (i=0; i<zahlen.length; i++) {
erg_tmp = "";
stillhad[i] = new Array();
stillhad[i].push(i);
zahl = zahlen[i];
atpos = 0;
abbr = 0;
////////////////////////
//zaehl = 0;
////////////////////////
while (abbr == 0) {
if (partOf(atpos, stillhad[i]) == false) {
zahl += zahlen[atpos];
erg_tmp += "|"+atpos;
stillhad[i].push(atpos);
}
atpos++;
document.write(erg_tmp + "<br>");
document.write(atpos + "<br>");
document.write(zahl + "<br><br>");
//document.write(stillhad[i] + "<br>");
if (zahl < maxworth) {
if (partOf(erg_tmp, erg) == false) {
erg[zahl] = erg_tmp;
erg_tmp = "";
}
}
if (zahl == maxworth) {
erg[maxworth] = erg_tmp;
abbr = 1;
}
if (atpos == (zahlen.length + 1))
atpos = 0;
if (zahl > maxworth)
abbr = 1;
//////////////
//zaehl++;
//if (zaehl > 100)
// abbr = 1;
////////////
/////////////////
}
}
function partOf(strng, arr) {
for (z=0; z<arr.length; z++) {
if (arr[z] == strng)
return z;
}
return false;
}
document.write(erg);
</script>
</head>
<body>
</body>
</html>