You are given a set S={S1,S2,.., SK}, an integer X and a sequence A1, A2,., AM. Let's define an infinite sequence W1, W2,.: for each valid i, Wi=A((i-1)%M)+1. Then, let's define a function F(i) for...


You are given a set S={S1,S2,.., SK}, an integer X and a sequence A1, A2,., AM.<br>Let's define an infinite sequence W1, W2,.: for each valid i, Wi=A((i-1)%M)+1.<br>Then, let's define a function F(i) for any non-negative integer i in the following way:<br>F(0)=X, if ieS -> F(i)=0, otherwise for i#0 -> F(i)=(Summation(E from j=1 till 1)F(i-j)Wj)%(1o^9+7)<br>Develop a python code to print list of the values of F.<br>Sample Input:<br>3 1 3 5<br>4<br>2 3 1<br>Sample Output:<br>[3, 6, 21, 63, 0, 231]<br>

Extracted text: You are given a set S={S1,S2,.., SK}, an integer X and a sequence A1, A2,., AM. Let's define an infinite sequence W1, W2,.: for each valid i, Wi=A((i-1)%M)+1. Then, let's define a function F(i) for any non-negative integer i in the following way: F(0)=X, if ieS -> F(i)=0, otherwise for i#0 -> F(i)=(Summation(E from j=1 till 1)F(i-j)Wj)%(1o^9+7) Develop a python code to print list of the values of F. Sample Input: 3 1 3 5 4 2 3 1 Sample Output: [3, 6, 21, 63, 0, 231]

Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here