function generateCombinations(gaps, currentCombination = '') {
if (gaps === 0) {
return currentCombination + '<br>';
}
const combinations = [];
combinations.push(...generateCombinations(gaps - 1, currentCombination + 'C'));
combinations.push(...generateCombinations(gaps - 1, currentCombination + '+'));
return combinations;
}
// Generate combinations for 4 gaps
const combinations = generateCombinations(4);
// Open a new window with the results
const newWindow = window.open();
newWindow.document.write('<html><body>');
newWindow.document.write('<pre>' + combinations.join('') + '</pre>');
newWindow.document.write('</body></html>');
newWindow.document.close();
lunes, 12 de junio de 2023
Variaciones con repetición 2 elementos para cuatro espacios
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario