2 Don't forget to check for a trailing seq.
source | link

(1) Yes, why wouldn't it be possible? Here is an implementation in Python. Beware that the algorithm for computing the outcomes table for each $n$ is $O(10^n)$, and it already takes over a minute to run on my machine with $n = 7$.

from itertools import product, tee
from collections import Counter

min_seq_len = 3
sides = 10

def outcomes(n_dice):
    counts = Counter()
    for got in product(*tee(range(1, sides + 1), n_dice)):
        # First check for n-of-a-kind (including 1-of-a-kind).
        best = max(n*v for n, v in Counter(got).items())
        # Now look for sequences.
        seq = []
        for v in sorted(set(got)):
            if not seq or v == seq[-1] + 1:
                seq.append(v)
            else:
                if len(seq) >= min_seq_len:
                    best = max(best, sum(seq))
                del seq[:]
        if len(seq) >= min_seq_len:
            best = max(best, sum(seq))
        counts[best] += 1
    return counts

def p_at_least(n_dice, bonus, the_min):
    enough = 0
    total = 0
    for n, outcome in outcomes(n_dice).items():
        total += n
        if outcome + bonus >= the_min:
            enough += n
    return enough/total

print(p_at_least(7, 2, 5))

(2) It seems that your concern is whether $f(n, b + 1, t)$ or $f(n + 1, b, t)$ is bigger for a given $n$, $b$, and $t$, which a derivative won't tell you.

(1) Yes, why wouldn't it be possible? Here is an implementation in Python. Beware that the algorithm for computing the outcomes table for each $n$ is $O(10^n)$, and it already takes over a minute to run on my machine with $n = 7$.

from itertools import product, tee
from collections import Counter

min_seq_len = 3
sides = 10

def outcomes(n_dice):
    counts = Counter()
    for got in product(*tee(range(1, sides + 1), n_dice)):
        # First check for n-of-a-kind (including 1-of-a-kind).
        best = max(n*v for n, v in Counter(got).items())
        # Now look for sequences.
        seq = []
        for v in sorted(set(got)):
            if not seq or v == seq[-1] + 1:
                seq.append(v)
            else:
                if len(seq) >= min_seq_len:
                    best = max(best, sum(seq))
                del seq[:]
        counts[best] += 1
    return counts

def p_at_least(n_dice, bonus, the_min):
    enough = 0
    total = 0
    for n, outcome in outcomes(n_dice).items():
        total += n
        if outcome + bonus >= the_min:
            enough += n
    return enough/total

print(p_at_least(7, 2, 5))

(2) It seems that your concern is whether $f(n, b + 1, t)$ or $f(n + 1, b, t)$ is bigger for a given $n$, $b$, and $t$, which a derivative won't tell you.

(1) Yes, why wouldn't it be possible? Here is an implementation in Python. Beware that the algorithm for computing the outcomes table for each $n$ is $O(10^n)$, and it already takes over a minute to run on my machine with $n = 7$.

from itertools import product, tee
from collections import Counter

min_seq_len = 3
sides = 10

def outcomes(n_dice):
    counts = Counter()
    for got in product(*tee(range(1, sides + 1), n_dice)):
        # First check for n-of-a-kind (including 1-of-a-kind).
        best = max(n*v for n, v in Counter(got).items())
        # Now look for sequences.
        seq = []
        for v in sorted(set(got)):
            if not seq or v == seq[-1] + 1:
                seq.append(v)
            else:
                if len(seq) >= min_seq_len:
                    best = max(best, sum(seq))
                del seq[:]
        if len(seq) >= min_seq_len:
            best = max(best, sum(seq))
        counts[best] += 1
    return counts

def p_at_least(n_dice, bonus, the_min):
    enough = 0
    total = 0
    for n, outcome in outcomes(n_dice).items():
        total += n
        if outcome + bonus >= the_min:
            enough += n
    return enough/total

print(p_at_least(7, 2, 5))

(2) It seems that your concern is whether $f(n, b + 1, t)$ or $f(n + 1, b, t)$ is bigger for a given $n$, $b$, and $t$, which a derivative won't tell you.

1
source | link

(1) Yes, why wouldn't it be possible? Here is an implementation in Python. Beware that the algorithm for computing the outcomes table for each $n$ is $O(10^n)$, and it already takes over a minute to run on my machine with $n = 7$.

from itertools import product, tee
from collections import Counter

min_seq_len = 3
sides = 10

def outcomes(n_dice):
    counts = Counter()
    for got in product(*tee(range(1, sides + 1), n_dice)):
        # First check for n-of-a-kind (including 1-of-a-kind).
        best = max(n*v for n, v in Counter(got).items())
        # Now look for sequences.
        seq = []
        for v in sorted(set(got)):
            if not seq or v == seq[-1] + 1:
                seq.append(v)
            else:
                if len(seq) >= min_seq_len:
                    best = max(best, sum(seq))
                del seq[:]
        counts[best] += 1
    return counts

def p_at_least(n_dice, bonus, the_min):
    enough = 0
    total = 0
    for n, outcome in outcomes(n_dice).items():
        total += n
        if outcome + bonus >= the_min:
            enough += n
    return enough/total

print(p_at_least(7, 2, 5))

(2) It seems that your concern is whether $f(n, b + 1, t)$ or $f(n + 1, b, t)$ is bigger for a given $n$, $b$, and $t$, which a derivative won't tell you.