def binom_post_alt(p, k,n, B, alpha,beta):
    """ Binomial Posteriori density P(p | k,n) using a Beta(alpha,beta) prior,
    which is equal to Beta(k+alpha, n−k+beta) density.

    [Function with pre-computed Beta function B]
    """
    return p**(k+alpha-1) * (1 - p)**(n-k+beta-1) / B