News for hackers. Stuff that matters.
Re:South Africa's lottery probed as 5, 6, 7, 8, 9 and 10 drawn by crazygringo on Wednesday December 02, 2020 @06:28PM (#25283232)
Sure, sorry. I'd used:

  2*(1/49)*(1/48)*(1/47)*(1/46)*365*1000*(45/50) = 12.9%
The initial "2" term is for consecutive numbers going both directions, and the final (45/50) term is to account for the fact that if you start with 4 or less and decreasing, or 46 or greater and increasing, you'll run out of numbers.

Edit: but if the numbers don't have to be drawn in order (e.g. 8-5-9-6-7 is OK), then the odds are much higher still:

  2*(4/49)*(3/48)*(2/47)*(1/46)*365*1000 = 344.5%
(With the initial "2" term accounting for 4 consecutive numbers on either side of the initial pick -- though I'm not sure I've got that entirely right?) Then it would happen three to four times a year. Even with a 6th ball drawn separately out of 20, that's still a 17% chance happening somewhere in the world in a year, given 1,000 daily draws.
Re:South Africa's lottery probed as 5, 6, 7, 8, 9 and 10 drawn by JoshTriplett on Wednesday December 02, 2020 @06:55PM (#25283476)
> Edit: but if the numbers don't have to be drawn in order (e.g. 8-5-9-6-7 is OK), then the odds are much higher still:

Most lotteries are order-insensitive, and typically present the results in ascending numeric order. The actual draw often happens in some order (e.g. numbered balls being drawn from a hopper), and it'd be even more unusual if the numbers were actually drawn in consecutive order, but drawing 5-2-3-1-4 would typically be presented as 1-2-3-4-5 and would still be remarked upon as unusual.

Re:South Africa's lottery probed as 5, 6, 7, 8, 9 and 10 drawn by Asraelite on Wednesday December 02, 2020 @07:37PM (#25283792)
To calculate the probability of some event with probability P coming true at least once out of N total tries, you do 1 - ((1 - P) ^ N), not P * N as you've done.

Doing this, your final figures should be 12.1% and 96.8%.

For the expected number of times it would happen though, you are right, it would be three or four times per year on average for the second case.

Re:South Africa's lottery probed as 5, 6, 7, 8, 9 and 10 drawn by kbenson on Wednesday December 02, 2020 @06:42PM (#25283363)
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.

Re:South Africa's lottery probed as 5, 6, 7, 8, 9 and 10 drawn by ALittleLight on Wednesday December 02, 2020 @07:32PM (#25283761)
Unless 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.
Re:South Africa's lottery probed as 5, 6, 7, 8, 9 and 10 drawn by bweitzman on Wednesday December 02, 2020 @06:42PM (#25283357)
FYI 0.129 = 1 / 7.75. I think you and person you're responding to are doing the same calculations, but inverted.