The actual values are:
number of items in set : total combinations 1 : 1 2 : 4 3 : 15 4 : 64 5 : 325 6 : 1956 7 : 13699 8 : 109,600 9 : 986,409 10 : 9,864,100 million 11 : 108,505,111 12 : 1,302,061,344 billion 13 : 16,926,797,485 14 : 236,975,164,804 15 : 3,554,627,472,075 trillion 16 : 56,874,039,553,216 17 : 966,858,672,404,689 18 : 17,403,456,103,284,420 quadrillion 19 : 330,665,665,962,404,000 20 : 6,613,313,319,248,079,000 quintillion 21 : 138,879,579,704,209,650,000 sextillion 22 : 3.0553507534926124e+21 zillion
I know this isn't the programming stack, but i figure some smarty-pants might be able to come up with a (real mathematical) formula based on the script and/or derived values?
The validation was derived from a permutation script (javascript below).
UPDATE: After staring at the results I found a relationship:
nr = (pr * ni) + ni where: pr = previous result nr = next result ni = next item
So I wrote a little baby script to test the "formula". (That's where the mega-big numbers came from, there's no way a home computer could permutate a zillion!)
var combos = 0; for(var items=1; items<100; items++){ combos = (combos * items) + items; console.log(items, combos); }
Javascript permutation script
function combinations (Asource){ var combos = []; var temp = []; var picker = function (arr, temp_string, collect) { if (temp_string.length) { collect.push(temp_string); } for (var i=0; i 0) { picker(arrcopy, temp_string.concat(elem), collect); } else { collect.push(temp_string.concat(elem)); } } } picker(Asource, temp, combos); return combos; } var combos = ["a", "b", "c", "d"]; // 5 in this set var findCombos = combinations (Asource); console.log(combos.length + " : " + findCombos.length);