off by 1 lottery probability A lottery, where 6 balls out of 50 are drawn randomly without replacement, allows players of the lottery to be off by at most 1 for each number on their lottery ticket.  Additional rules of the lottery are as follows:


*

*The balls are numbered 1 thru 50 and are all equally likely to be drawn.

*Both the winning numbers drawn and the players tickets contain random numbers (from 1 to 50).  That is, the player does not pick/choose their own numbers, it is done randomly for them via computer.

*Both the winning numbers and the numbers on lottery tickets are sorted in ascending order and winning tickets must match/map in that order.  For example, if the winning numbers drawn are (sorted) 5, 10, 15, 16, 20, and 30 and the ticketholder has 5, 10, 16, 17, 20, and 30 (also sorted), the 16s will not map together.  The matching numbers are (5:5), (10:10), (15:16), (16:17), (20:20), and (30:30).  That is a winning ticket.
So the question is how much more likely is a single lottery ticket expected to be a winner using the off by 1 rule verses a similar but much stricter lottery (also 6 out of 50 balls) but which disallows the off by 1 rule (numbers must match exactly)?
Work done so far:
The strict lottery chances of winning on a single ticket are 1 in about 15.9 million which is 1 / (50 choose 6).
The off by 1 lottery was simulated on computer and I am seeing a 503 increase in probability (about 1 in 31,600 chance of winning).
I would like to know if this type of problem can be done mathematically or if it is too difficult.  Also, I was hoping someone could do a simulation also to help verify my finding of 503x increase in chances of winning.
Additional info that may be helpful for analysis...  The worst case boost in expected win probability is 7x if (for example), the drawn balls are 1,2,3,4,5,6.  This would match the following tickets: (1,2,3,4,5,6), (1,2,3,4,5,7), (1,2,3,4,6,7), (1,2,3,5,6,7), (1,2,4,5,6,7), (1,3,4,5,6,7), and (2,3,4,5,6,7).  Best case boost is 729x where the drawn balls are something like 5, 10, 15, 20, 23, 30. The 3 most frequent boost scenarios (from simulation results) are 486x, 648x, and 729x.  These are 3 out of 137 scenarios I am seeing in simulation of 100,000,000 decisions. I am not yet sure if there more.
If something is unclear, please ask before attempting to answer the question and I will clarify.
 A: Here's a quick derivation which gives the same solution as that provided by gar, although a slightly different recursion.
A winning $k$ ball combination consists of integer sequences $0<x_1<\cdots<x_k$ and $0<y_1<\cdots<y_k$ so that $|x_i-y_i|\le1$.
Let $A_k(n)$ be the number of ways to pick winning $k$ ball combinations so that $x_k,y_k\le n$. This is the same as $T(n+1,k)$ defined by gar.
Similarly, let $B_k(n)$ be the number of ways to pick $k$ ball combinations so that $x_k\le n$ and $y_k\le n+1$. We'd get the same number of instead we require $x_k\le n+1$ and $y_k\le n$ due to symmetry.
Obviously, $A_k(n)=B_k(n)=0$ for $n<k$. Otherwise, $A_0(n)=B_0(n)=1$.
Let's first consider $A_k(n)$. If $(x_k,y_k)=(n,n)$, what remains is picking the remaining $k-1$ balls with $x_{k-1},y_{k-1}\le n-1$, which can be done in $A_{k-1}(n-1)$ ways. If $(x_k,y_k)=(n,n-1)$, the remaining $k-1$ balls should have $x_{k-1}\le n-1$ and $y_{k-1}\le n-2$, which can be done in $B_{k-1}(n-2)$ ways; the same applies to $(x_k,y_k)=(n-1,n)$. Otherwise, $x_k,y_k\le n-1$, which leaves $A_k(n-1)$ alternatives. Thus,
$$
A_k(n)=A_{k-1}(n-1)+2B_{k-1}(n-2)+A_k(n-1).
$$
We derive a recursion for $B_k(n)$ in a similar way. If $(x_k,y_k)=(n,n+1)$, the remaining $k-1$ balls require $x_{k-1}\le n-1$, $y_{k-1}\le n$, leaving $B_{k-1}(n-1)$ alternatives. Otherwise, $x_k,y_k\le n$, leaving $A_k(n)$ alternatives. Thus,
$$
B_k(n)=B_{k-1}(n-1)+A_k(n).
$$
Plugging in $k=6$, $n=50$ gives $A_6(50)=8000567708$. Since each of the two integer sequences are drawn randomly with probability $1/\binom{n}{k}$, this gives the probability of winning
$$
\frac{A_6(50)}{\binom{50}{6}^2}
=\frac{8000567708}{15890700^2}\approx 0.00003168361647.
$$
A: You've already seen there are different cases of winning numbers $a_1 < \dots < a_6$. That is, the number of winning tickets under the off-by-one rule varies based on the gaps between the winning numbers. You can model the different cases as $7$-tuples $(x_0, x_1, x_2, x_3, x_4, x_5, x_6)$. Here $x_i$ denotes the gap between the $i$-th and $i+1$-th number for $1 \leq i \leq 5$, so $x_i = a_{i+1} - a_i$. The $x_0$ and $x_6$ denote the gap between the "edges", that is, the numbers 1 and 50, so $x_0 = a_1 - 1$ and $x_6 = 50 - a_6$.
For achieving the maximum number of winning tickets we have two "empty spots" around each $a_i$ that don't overlap with the other empty spots. Then, for each $a_i$ we have 3 matching numbers under the off-by-one rule, independently, so the number of winning tickets is $3^6 = 729$. The condition on the $x_i$ is that for $1 \leq i \leq 5$ we have $x_i \geq 2$ (for if $x_i = 1$ then we have one "overlapping gap" between two numbers), and we have $x_0, x_6 \geq 1$. Otherwise, we want the $x_i$ to sum to $50-6 = 44$. The number of winning numbers that meets these conditions is ${44 - 5-1\choose 7-1} = {38 \choose 6}$ (Stars and bars, where we first subtract 1 from each $x_i$ for $1 \leq i \leq 5$, so we're looking for 7-tuples of positive integers that sum to $44-5 = 39$)
The full answer can be computed by considering all different conditions for the $x_i$ . For $1 \leq i \leq 5$ we have 3 conditions: $x_i = 0 \vee x_i = 1 \vee x_i \geq 2$. For $i \in \{0, 6\}$ we have either $x_i = 0$ or $x_i \geq 1$.
For example, fixing $x_i = 1$ for a single $1 \leq i \leq 5$ and leaving the other conditions as in the maximum situation we just computed, we have a single "overlapping gap" between two numbers, hence the number of matching tickets will be $3^4 \cdot 8 = 648$. The number of winning numbers that match this will be ${39 \choose 5} \cdot 5$, where multiplication with 5 follows from that we can pick $i \in \{1, 2, 3, 4, 5\}$.
As we saw here, the $x_i$ do not play a unique role, i.e. they are basically symmetric (besides the difference between the "interior" ones and the ones at the edges). However, fixing two adjacent $x_i$ is different from fixing two non-adjacent $x_i$.
A: The probability of winning is given by
\begin{align*}
  P(win) &= \frac{T(n+1,k)}{\dbinom{n}{k}^2}
\end{align*}
where $T(n,k)$ is computed by the recurrence relation
\begin{align*}
  T(n,k) &= T(n-1,k) + 2*T(n-1,k-1) + T(n-2,k-1) - T(n-2,k-2)\\
  T(0,0) = T(1,0) = T(2,0) = T(2,1) &= 1\\ 
  T(1,1) = T(2,2) &= 0 \\
  T(n,k) &= 0  \;\;\;\;\;\;\text{if $k<0$ or $k>n$}
\end{align*}
as given in A209414
Hence, for $n=50, k=6$, the resulting probability is
\begin{align*}
  P(win) &= \frac{8000567708}{\dbinom{50}{6}^2}\approx 0.0000316836
\end{align*}
I have matched with simulations for small values and they seem to agree.
For example, in J:
   n=: 9
   k=: 5
   sim=: 3 : 0
a=:/:~k?n
win=:/:~k?n
k=(+/0=|a-win)+(+/1=|a-win)
)
   (+/%#)(sim"0)1e6#0

which gave about 0.28, close to actual $\dfrac{4446}{\dbinom{9}{5}^2}\approx 0.280045351473923$
Update
Some implementations,
In python:
def memoize(f):
    """ Memoization decorator for functions taking one or more arguments. """
    class memodict(dict):
        def __init__(self, f):
            self.f = f
        def __call__(self, *args):
            return self[args]
        def __missing__(self, key):
            ret = self[key] = self.f(*key)
            return ret
    return memodict(f)

@memoize
def T(n,k):
    if n == 0 and k == 0:
        return 1
    if n == 1 and k == 0:
        return 1
    if n == 2 and k == 1:
        return 1                
    if n == 2 and k == 0:
        return 1   
    if n == 1 and k== 1:
        return 0
    if n == 2 and k == 2:
        return 0
    if n < k or k< 0:     
        return 0
    return T(n-1,k) + 2*T(n-1,k-1) + T(n-2,k-1) - T(n-2,k-2)
nn = 50
kk = 6
print T(nn+1,kk)

The memoization decorator is taken from here
If a CAS is used, it's easier to implement.
E.g., in FriCAS:
)set fun cache all A
T(0,0) == 1
T(1,0) == 1
T(2,0) == 1
T(2,1) == 1
T(1,1) == 0
T(2,2) == 0
T(n,k) == 
  if k<0 or k>n then 0
  else T(n-1,k) + 2*T(n-1,k-1) + T(n-2,k-1) - T(n-2,k-2)
T(51,6)

and Einar Rødland's formula:
)set fun cache all A
)set fun cache all B
A(n,0) == 1
B(n,0) == 1
A(n,k) == 
    if k>n then 0
    else A(n-1,k-1)+2*B(n-2,k-1)+A(n-1,k)
B(n,k) == 
    if k>n then 0
    else B(n-1,k-1)+A(n,k)
A(50,6) 

