def prob_page_pattern_match(q, q1, t, m, s):
    """
    Probability that a page pattern of q + t pages contains another page pattern
    of q1 pages, assuming that all pages are equiprobable. Parameter m
    represents the total number of pages.
    """
    #prob_same_page = (harmonic_approx(m, 2*s)
    #                   / (harmonic_approx(m, s) ** 2))
    prob_same_page = float(1) / m
    prob_single_page_no_match = (1 - prob_same_page) ** (q + t)
    return (1 - prob_single_page_no_match) ** q