3 ms·
Oh. I assumed consecutive numbers, but not necessarily consecutive on each pull. That is, 1,2,3,4,5 is no different than 2,3,4,5,1 in my calculations, which m
by kbenson 6y ago
Oh. I assumed consecutive numbers, but not necessarily consecutive on each pull. That is, 1,2,3,4,5 is no different than 2,3,4,5,1 in my calculations, which makes the possible ways got get consecutive numbers at the end quite a bit higher. Still not positive I got it right, but at least I know it shouldn't match your results, as they are for slightly different things. :)
Edit: What I did was take all the possible combinations of 5 balls (5!) by the number of different sets that could be drawn (50-5, based on lowest number), over the total possible draws (50!). I think perhaps what that does it not account for overlap between sets (1-5 and 2-6), inflating the number somewhat, which is why it's a bit more than twice the probability than you got for any possible sequence of 5.
- ALittleLight 6y agoUnless I'm doing something wrong here - just typing some javascript into the console gives me... function rn() { return parseInt(Math.random() * 100); } function drawing(){ let result = [rn(), rn(), rn(), rn(), rn()]; return result.sort(); }; function sequential(arr){ for(let i = 0; i < arr.length-1; i++){ if(arr[i] + 1 != arr[i+1]){ return false } } return true } let counter = 0; for (let i = 0; i < 10000000; i ++){ if (sequential(drawing())){ counter ++; } }; console.log(counter); 16 Mathematically, it seems like you'd need to draw one of five numbers from the range, then one of four numbers, then one of three... so the likelihood would be 5/100 * 4/100 * 3/100 * 2/100 * 1/100 = 0.000000012. Although those odds don't seem to line up with the javascript I posted.