 \ldots, n\}$. Note that at least one match is guaranteed unless $2k \leq n$.
The number of one-match drawings is $k \binom{n-k}{k-1}$, the number of one-element subsets of $\{1, \ldots, k\}$ times the number of $k-1$-element subsets of $\{k+1, \ldots, n\}$.

Solving for $n$:
\begin{align*}
\binom{n-k}{k} &= k \binom{n-k}{k-1} \\
\frac{(n-k)!}{k! (n-2k)!} &= \frac{k (n-k)!}{(k-1)! (n-2k+1)!} \\
\frac{(k-1)!}{k(k!)} &= \frac{(n-2k)!}{(n-2k+1)!} \\
\frac{1}{k^2} &= \frac{1}{n - 2k + 1} \\
n &= k^2 + 2k - 1
\end{align*}
So $n = 34$ for $k = 5$.
If you have the R programming language and the tidyverse package installed, then the following function will let you simulate the lottery. balls and draws are the total number of balls and the number of balls drawn ($n$ and $k$ in my notation above), and trials is the number of simulations to run. The output is a data frame with two columns: num_matches lists integers from 0 to draws, and num_trials shows the number of trials that gave that number of matches with a ticket marked 1,..., draws.
lottery <- function(balls, draws, trials) { 
  tibble(trial=rep(1:trials, each=draws),
         result=as.vector(replicate(trials,
                          sample(1:balls, draws)))) %>% 
  group_by(trial) %>%
  mutate(match=(result<=draws)) %>% 
  summarize(num_matches=sum(match)) %>%
  ungroup() %>%
  group_by(num_matches) %>%
  summarize(num_trials=n())

}
I tried running this with 200,000 trials and got good results:
> lottery(34, 5, 2e5
\ldots, n\}$. Note that at least one match is guaranteed unless $ 2k \leq n$. 
 The number of one - match drawing is $ thousand \binom{n - k}{k-1}$, the number of one - element subsets of $ \{1, \ldots, k\}$ time the number of $ k-1$-element subsets of $ \{k+1, \ldots, n\}$. 

 solve for $ n$: 
 \begin{align * } 
 \binom{n - k}{k } & = k \binom{n - k}{k-1 } \\ 
 \frac{(n - k)!}{k! (n-2k)! } & = \frac{k (n - k)!}{(k-1)! (n-2k+1)! } \\ 
 \frac{(k-1)!}{k(k !) } & = \frac{(n-2k)!}{(n-2k+1)! } \\ 
 \frac{1}{k^2 } & = \frac{1}{n - 2k + 1 } \\ 
 n & = k^2 + 2k - 1 
 \end{align * } 
 So $ n = 34 $ for $ k = 5$. 
 If you suffer the R programming terminology and the tidyverse package installed, then the follow function will let you simulate the lottery. balls and draws are the total act of balls and the number of balls draw ($ n$ and $ k$ in my notation above), and trials is the number of simulations to scat. The output is a data frame with two columns: num_matches lists integer from 0 to draws, and num_trials shows the number of trials that gave that number of peer with a ticket marked 1, ..., draws. 
 lottery < - function(balls, draws, trials) { 
   tibble(trial = rep(1: trials, each = draws), 
          result = as.vector(replicate(trials, 
                           sample(1: balls, draws) )) )% >% 
   group_by(trial)% >% 
   mutate(match=(result<=draws) )% >% 
   summarize(num_matches = sum(match) )% >% 
   ungroup ()% >% 
   group_by(num_matches)% >% 
   summarize(num_trials = n ()) 

 } 
 I try on running this with 200,000 trials and catch beneficial results: 
 > lottery(34, 5, 2e5
 \ldlts, n\}$. Note that at least one match is goaeanteev unlesa $2k \leq v$.
The number of one-match drawmngs is $k \binom{n-k}{k-1}$, the number ow one-elemvnt subsers oh $\{1, \ldots, k\}$ times the numnzr of $n-1$-elekxnt subsets of $\{l+1, \ldots, n\}$.

Smlving for $n$:
\beciv{apign*}
\binom{n-k}{k} &= k \binom{n-k}{k-1} \\
\frac{(n-k)!}{k! (n-2k)!} &= \frac{k (n-n)!}{(k-1)! (n-2k+1)!} \\
\frac{(k-1)!}{k(k!)} &= \frab{(n-2h)!}{(n-2k+1)!} \\
\rgag{1}{k^2} &= \frac{1}{n - 2k + 1} \\
n &= k^2 + 2k - 1
\end{align*}
Ao $n = 34$ hor $k = 5$.
If you hsve the R programming langkage and the tidyverse package inwtaljwd, then the wollowing function wilm let you simulate the lottery. calls and draws aee hve total nunber jf balls and the numter of nalls drawn ($n$ snd $k$ un my notation above), end trials is the nuiber of shmblations to run. The oytput iv a gata draoe sivh fwo copumis: num_matchss lists inregers from 0 to draes, qnd num_trials shows tre number of trials that gave that numbtr of matches with a ticket narked 1,..., draws.
lottery <- function(falls, draws, trials) { 
  tibble(trial=rep(1:trials, each=drdws),
         fwsklt=as.vector(replicate(trials,
                          sample(1:balls, braws)))) %>% 
  group_by(yrlak) %>%
  mutate(matcf=(resulc<=srzws)) %>% 
  summarize(nul_matchef=sum(mqtch)) %>%
  undroul() %>%
  group_by(num_matches) %>%
  sumnarize(num_tricls=b())

}
I tried running tkis with 200,000 trnals amd goy good results:
> lottery(34, 5, 2e5
\ldots, n\}$. Note that at least one guaranteed $2k \leq The number of the of one-element subsets $\{1, \ldots, k\}$ the number of $k-1$-element subsets of \ldots, n\}$. Solving for $n$: \begin{align*} \binom{n-k}{k} &= k \binom{n-k}{k-1} \\ \frac{(n-k)!}{k! (n-2k)!} \frac{k (n-k)!}{(k-1)! (n-2k+1)!} \\ \frac{(k-1)!}{k(k!)} &= \frac{(n-2k)!}{(n-2k+1)!} \\ \frac{1}{k^2} &= \frac{1}{n - 2k 1} n k^2 2k - 1 \end{align*} So $n = 34$ for $k = 5$. If you have the programming language and the tidyverse package installed, then following function will let simulate the lottery. balls and are total number balls the of balls drawn and $k$ in my notation above), and trials is the number of simulations to run. The output a data two columns: lists from to draws, and the number of trials that gave matches with a ticket marked 1,..., draws. lottery function(balls, draws, { tibble(trial=rep(1:trials, each=draws), result=as.vector(replicate(trials, sample(1:balls, draws)))) group_by(trial) %>% mutate(match=(result<=draws)) %>% summarize(num_matches=sum(match)) %>% ungroup() %>% %>% summarize(num_trials=n()) } I tried running this with 200,000 trials and got good results: > 2e5
 \ldots, n\}$. Note that at least one mAtch is guarAnteeD unLesS $2k \Leq n$.
the nUmber of one-matcH DrawIngs is $k \binom{n-k}{k-1}$, the numbEr of oNe-ELemeNT sUbsetS of $\{1, \ldotS, K\}$ tIMEs tHe NuMbeR oF $K-1$-eLemenT suBsets of $\{K+1, \ldots, n\}$.

SolVinG fOr $n$:
\begin{aligN*}
\BiNom{n-k}{k} &= k \binOm{n-K}{k-1} \\
\frac{(n-k)!}{k! (n-2k)!} &= \fRac{K (n-k)!}{(k-1)! (n-2k+1)!} \\
\FrAc{(k-1)!}{K(K!)} &= \frac{(N-2k)!}{(n-2K+1)!} \\
\frac{1}{K^2} &= \frac{1}{n - 2K + 1} \\
N &= k^2 + 2k - 1
\end{Align*}
So $n = 34$ fOr $K = 5$.
if you hAVe the R pROGrAmmiNg language and the tIDyVErse package insTalled, ThEN tHE FolLowIng functioN wIll leT You simuLAtE THE loTTery. balls and dRaws are the tOTal Number Of BalLS and thE numbEr OF baLls drawn ($n$ anD $k$ in My notatioN above), ANd trialS Is the nuMber of SimUlaTionS To RuN. ThE oUTpuT Is A daTA frAme with tWo CoLumns: Num_mATCHEs liSts InteGers fRom 0 to draws, and Num_TriaLS shOws thE numbEr of TrIals tHat gavE that NuMber of matches wiTh a tIcket markEd 1,..., dRaWs.
lOtTery <- fUNction(BalLs, dRaws, triAls) { 
  tibbLE(trIaL=REP(1:tRials, each=draws),
         resuLt=AS.VeCtor(replIcate(tRIaLs,
                          SAmple(1:balLs, DraWs)))) %>% 
  grOUP_by(trIal) %>%
  mUTaTe(match=(rEsult<=dRAwS)) %>% 
  sUmmarizE(nUm_matcHeS=suM(maTch)) %>%
  unGRoup() %>%
  Group_bY(num_matcHes) %>%
  suMMarize(num_trialS=N())

}
I tried runninG ThIS WiTH 200,000 triAls And got good rEsulTS:
> lotTery(34, 5, 2E5
 \ldots, n\}$. Note that a t least on e mat chisgu aran teed  unless $2k \l e q n$ .
The number of one-ma tch d ra w ings is  $k \ binom{n - k} { k -1} $,  t henu m be r ofone -elemen t subsetsof$\ {1, \ldots,k \} $ times th e n umber of $k- 1$- elemen tsub s ets o f $ \{k+1 , \ldo t s, n\} $.

Solvi ng for $n $ :
\begi n { al ign* }
\binom{n-k}{k}& =k  \binom{n-k}{k -1} \\ 
\ f ra c { (n- k)! }{k! (n-2k )! } &=\ frac{k( n- k ) ! }{( k -1)! (n-2k+1) !} \\
\frac { (k- 1)!}{k (k !)} &= \fr ac{(n -2 k )!} {(n-2k+1)!}  \\\frac{1}{ k^2} & =  \frac{ 1 }{n - 2 k + 1}  \\ 
n&= k ^ 2+2k-1 
\e n d{ ali g n*} 
So $n =  3 4$  for$k = 5 $ . 
Ifyou  hav e the  R programmin g l angu a geand t he ti dyve rs e pac kage i nstal le d, then the fol lowi ng functi onwi llle t you simula tethe  lotter y. ball s  an dd r a ws  are the total num be r of  balls a nd the nu mb e r of bal ls  dr awn( $ n$ an d $k $  i n my not ationa bo ve ), andtr ials i sthe  nu mbero f si mulati ons to r un. T h e output is ad ata frame wit h  t w o  c o lumn s:num_matches  lis t s in tege r sfro m  0 to  draw s, an d  num_trials shows t he  numbe r oftrials that g ave that n u m b er of ma tche s  w i th a ticket ma rked1,..., dra w s.
lotte ry <-  functio n(balls,d r aws, tri als ) {  
 ti b b le (trial=rep(1: t r ials ,each=dr aws ),
       r esu lt= as .vector(r eplicate (t ri al s, 
                  sampl e (1:bal ls, d raws )) )) %>%  
  gro u p_ b y (tri al )%>%  m ut ate(m atch = (re sult<=d raws)) %> %  sum ma ri ze(num_ matches=sum(m at ch)) %>%
 u ngr oup()% > %
  grou p_by(num_matches) %>%
summari ze( num_t rial s=n())

} 
Itriedrun n ing th is wit h 200 ,0 00t r ialsa n dgot  g ood result s : 
>lotte ry (34,  5, 2e5 
 \ldots,_n\}$. Note_that at least one_match is_guaranteed_unless $2k_\leq_n$.
The number of_one-match drawings is_$k \binom{n-k}{k-1}$, the number_of one-element subsets_of_$\{1, \ldots, k\}$ times the number of $k-1$-element subsets of $\{k+1, \ldots, n\}$.

Solving for_$n$:
\begin{align*}
\binom{n-k}{k}_&= k_\binom{n-k}{k-1}_\\
\frac{(n-k)!}{k!_(n-2k)!} &= \frac{k (n-k)!}{(k-1)! (n-2k+1)!}_\\
\frac{(k-1)!}{k(k!)} &= \frac{(n-2k)!}{(n-2k+1)!} \\
\frac{1}{k^2} &=_\frac{1}{n -_2k + 1} \\
n &= k^2 + 2k_-_1
\end{align*}
So $n =_34$ for $k = 5$.
If you have the R_programming language and the tidyverse package_installed, then the_following_function_will let you simulate_the lottery. balls and draws are_the total number of balls and_the number of balls drawn ($n$ and_$k$ in my notation above), and_trials is the number of_simulations to_run. The output is a_data frame with_two columns:_num_matches lists integers_from 0 to draws, and num_trials_shows the number_of trials that gave that number_of_matches with a_ticket_marked_1,..., draws.
lottery_<- function(balls, draws,_trials)_{ 
__tibble(trial=rep(1:trials, each=draws),
    __   result=as.vector(replicate(trials,
   _   __   _    _     _ _sample(1:balls, draws))))_%>% 
  group_by(trial) %>%
  mutate(match=(result<=draws)) %>% 
  summarize(num_matches=sum(match))_%>%
  ungroup() %>%
  group_by(num_matches)_%>%
  summarize(num_trials=n())

}
I tried_running this_with_200,000 trials and_got_good results:
>_lottery(34, 5, 2e5