# Mathematica can't minimize a function

Mathematica seems not to be able to minimize this univariate function over integer arguments, $r>2, r \in \mathbb{Z}$.

k=6;
SB[n_, r_] :=
Sum[Binomial[r Binomial[2 k, 2]/2, i] Binomial[
Binomial[n, 2] - r Binomial[2 k, 2]/2,
r Binomial[k, 2] + r - i], {i, r Binomial[k, 2] + r/2,
r Binomial[k, 2] + r}]

NMinimize[{SB[k r, r], Element[r, Integers] && r > 2}  , r]


This takes forever, even if, evaluated with Table the function in the interval $r=(2,100]$ for example, has perfectly valid values. The other command FindInstance seems unable to tell me a valid value when checking if $S_B(k r,r) > 0$ even if this is true for every value of $r$.

Some help to make this computation faster or let it converge to a feasible solution? I know the solution is at $r=2$ but I just want to know how to properly specify this problem that is part of a more general framework.

If you use: SB[n_?NumericQ, r_?NumericQ] in your definition things work as you expect.

Otherwise, SB is evaluated symbolically and that will take forever...

Clear["Global*"]
k = 6.;
SB[n_, r_] :=
Sum[Binomial[r Binomial[2 k, 2]/2, i] Binomial[
Binomial[n, 2] - r Binomial[2 k, 2]/2, r Binomial[k, 2] + r - i],
{i, r Binomial[k, 2] + r/2, r Binomial[k, 2] + r}]
SB[# k, #] & /@ Range[100] // Timing
ListLogPlot[%[[2]]]


way 2

Clear["Global*"]
sum[r_] := Sum[(Gamma[1 + 33 r] Gamma[1 - 36 r + 18 r^2])/(
Gamma[1 + i] Gamma[1 - i + 16 r] Gamma[1 - i + 33 r] Gamma[
1 + i - 52 r + 18 r^2]), {i, (31 r)/2, 16 r}];
(data = sum[1. #] & /@ Range[2, 300];) // Timing
ListLogPlot[data, AxesLabel -> {"r", "sum"}]