Answer to Question #94653 in Programming & Computer Science for mlk

Question #94653
Calculate ∑_(i=0)^111〖3^i C(111,i)〗
1
Expert's answer
2019-09-18T02:50:41-0400
#
# Python 3.6
from scipy.special import comb


def calc_seq(m):
    assert m >= 0
    seq = [1]
    for k in range(1, m + 1):
        seq.append(seq[-1] + (3 ** k) * comb(111, k, exact=True))
    return seq


def calc_one(m):
    assert m >= 0
    num = 0
    for k in range(m + 1):
        num += (3 ** k) * comb(111, k, exact=True)
    return num


def main():
    print(calc_seq(6))
    # [1, 334, 55279, 6044284, 491153689, 31635177490, 1682268438943]
    print()
    print(calc_one(111))
    # 6739986666787659948666753771754907668409286105635143120275902562304


if __name__ == '__main__':
    main()

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS