JSFiddle - React, Tailwind, and code Playground
JavaScript
let BSM = [
[1,7,5,0],
[1,7,2,7],
[1,7,4,7],
[1,8,2,8],
];
const allBSM = [];
BSM.forEach((v, i) => {
for(let j = i+1; j < BSM.length; j += 1) {
allBSM.push([...v, ...BSM[j]].sort().join(''));
}
});
let found = 0;
for (let i = 10000000; i <= 99999999; i += 1) {
const str = `${i}`.split('').sort().join('');
if (allBSM.some(v => v === str)) found +=1;
}
const nothing = 100000000 - found;
console.log('Rien', `${nothing}/100 000 000 = ${nothing/1000000}%`);
console.log('Deux dates trouvées', `${found}/100 000 000 = ${found/1000000}% soit 1 chance sur ${Math.round(100000000/found)}`);