Lecture 13: Due Oct. 25, 9:00pm. Email ShaloshBEKhad@gmail.com an attachment hw13FirstLast.txt Indicate whether it is OK to post 1) Let A be the set of letters in your name e.g. in my case it is {b,d,e,i,g, o,l, r,n,z}. {1, 2, 3, 4, 5, 6} Set A = {A, D, E, I, L, N} #Daniel (i) How many 100-letter "words" (i.e. sequences) in this alphabet are there where no two consonants can be adjacent? A: L:=[seq(seq(NuPaths([{2,3,4,5,6},{1,3,4},{1,2,4,5,6},{1,2,3,5,6},{1,3,4},{1,3,4}],i,j,100),i=1..6),j=1..6)] S:=convert(L,`+`) =501149526326449591017818496561543096798405108948690084822475806 (ii) How many 100-letter "words" (i.e. sequences) in this alphabet are there where no two vowels can be adjacent? A: L:=[seq(seq(NuPaths([{2,5,6},{1,3,4,5,6},{2,5,6},{2,5,6},{1,2,3,4,6},{1,2,3,4,5}],i,j,100),i=1..6),j=1..6)] S:=convert(L,`+`) =501149526326449591017818496561543096798405108948690084822475806 (iii) How many 100-letter "words" (i.e. sequences) in this alphabet are there where no two vowels can be adjacent and no consonants can be adjacent? A: L:=[seq(seq(NuPaths([{2,5,6},{1,3,4},{2,5,6},{2,5,6},{1,3,4},{1,3,4}],i,j,100),i=1..6),j=1..6)] S:=convert(L,`+`) =3092265124392067986218766778593727636212645132006 (iv) Let a(n) be the number of n-letters of words in that alphabet that have neither adjacent vowels nor adjacent consonants, and let f(t)=Sum(a(n)*t^n,n=0..infinity) Find f(t) explicilty. A: Error, too many levels of recursion on NuPaths, impossible to find? heres a(n) used a := proc(n) local i, j, L, S; L := [seq(seq(NuPaths([{2, 5, 6}, {1, 3, 4}, {2, 5, 6}, {2, 5, 6}, {1, 3, 4}, {1, 3, 4}], i, j, n), i = 1 .. 6), j = 1 .. 6)]; S := convert(L, `+`); S; end proc 2) Using the appropriate procedure in M13.txt solve the following ancient puzzle (no credit for other methods!) A farmer, a wolf, a sheep, and a (very big) cabbage have to cross a river using a row boat that can only have the farmer and one of the other animals/vegetable. The wolf and the sheep can't be left unsupervised, and neither can the sheep and the cabbage (but the wolf and the cabbage can be left safely alone). How can this be done? #Farmer = f, Wolf = w, Sheep = s, Cabbage = c #State 01: {[f, w, s, c] : []} (state 1) #State 02: {[w, c] : [f, s]} (state 1->2) #State 03: {[f, w, c] : [s]} (state 2->3) #State 04: {[c] : [f, w, s]} (state 3->4) #State 05: {[w] : [f, c, s]} (state 3->5) #State 06: {[f, s, c] : [w]} (state 4->6) #State 07: {[f, w, s] : [c]} (state 5->7) #State 08: {[s] : [f, w, c]} (state 6->8, 7->8) #State 09: {[f, s] : [w, c]} (state 8->9) #State 10: {[] : [f, w, s, c]} (state 9->10) #G:=[{2},{3},{4,5},{6},{7},{8},{8},{9},{10},{}] A:={[1, 2, 3, 4, 6, 8, 9, 10], [1, 2, 3, 5, 7, 8, 9, 10]} 4) Using the appropriate procedure in M13.txt solve the following more challenging puzzle 3 Missionaries and 3 Canibals have to cross a river using a row boat that can have at most two passengers (and at least one, it is not a self-driving boat). At no time can the canniabls outnumber the missionaries on either river-bank (unless there are no missionaries, of course). How to do it? # c# = Canibal 1-3, m# = Missionary 1-3, b = Boat #State 01: {[c3, m3, b] : [c0, m0, 0]} (state 1) #State 02: {[c2, m3, 0] : [c1, m0, b]} (state 1->2) #State 03: {[c2, m2, 0] : [c1, m1, b]} (state 1->3) #State 04: {[c2, m3, b] : [c1, m0, 0]} (state 3->4) #State 05: {[c1, m3, 0] : [c2, m0, b]} (state 4->5) #State 06: {[c0, m3, 0] : [c3, m0, b]} (state 4->6) #State 07: {[c1, m3, b] : [c2, m0, 0]} (state 6->7) #State 08: {[c1, m1, 0] : [c2, m2, b]} (state 7->8) #State 09: {[c2, m2, b] : [c1, m1, 0]} (state 8->9) #State 10: {[c2, m0, 0] : [c1, m3, b]} (state 9->10) #State 11: {[c3, m0, b] : [c0, m3, 0]} (state 10->11) #State 12: {[c1, m0, 0] : [c2, m3, b]} (state 11->12) #State 13: {[c2, m0, b] : [c1, m3, 0]} (state 12->13) #State 14: {[c0, m0, 0] : [c3, m3, 0]} (state 13->14) #G:=[{2,3},{},{4},{5,6},{},{7},{8},{9},{10},{11},{12},{13},{14},{}] A:{[1, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14]}