> #ATTENDANCE QUIZ FOR LECTURE 2 of Dr. Z.'s Math454(02) Rutgers University > > # Please Edit this .txt page with Answers > > #Email ShaloshBEkhad@gmail.com > #Subject: p2 > #with an attachment called > #p2FirstLast.txt > #(e.g. p2DoronZeilberger.txt) > > #Right after finishing watching the Second lecture but no later than Friday, Sept. 11, 2020, 8:00pm > > > > > #Q1. THE FIRST ATTENDANCE QUESTION WAS: > #ATTENDANCE QUESTION #1 ; > #Let a: = FIRST DIGIT of your RUID ; > ; > #Let b: = SECOND DIGIT of your RUID ; > #Let b: = FIFTH DIGIT of your RUID ; > #Let d: = SIXTH DIGIT of your RUID ; > #HOW MANY WALKS IN MANHATTAN ARE THERE (NOT USING BDWAY) ; > #From CORNER of min(a, b) St and min(c, d) Ave ; > #to CORNER OF max(a, b St and max(c, d) Ave ; > #Walking in the positive direction ; > #A1. MY ANSWER TO THE FIRST ATTENDANCE QUESTION IS: > F:=proc(m,n) option remember: > > if m<0 or n<0 then > > 0: > > elif m=0 and n=0 then > > 1: > > else > > F(m-1,n)+F(m,n-1): > > fi: > > end: > ; > a := 1 a := 1 ; > b := 7 b := 7 ; > c := 0 c := 0 ; > d := 7 d := 7 ; > #corner1 ; > min(a, b) 1 ; > min(c, d) 0 ; > #corner ; > max(a, b) 7 ; > max(c, d) 7 ; > #From(1,0) to (7,7) = From(0,0) to (6, 7) ; > F(6,7) 1716 ; > #There are 1716 Walks ; > #Q2. THE SECOND ATTENDANCE QUESTION WAS: > > ; > #SECOND ATTENDANCE QUESTION FOR LECTURE 2 ; > #CONSIDER YOUR RUID AS A WORD of LENGTH 9 in ; > #THE 10-LETTER "ALPHABET" {0,1,2,3,4,5,6,7,8,9} ; > #HOW MANY WAYS TO REARRANGE YOUR RUID? ; > > #A2. MY ANSWER TO THE SECOND ATTENDANCE QUESTION IS: > NuW:=proc(L) local k,i: > option remember: > > k:=nops(L): > > if min(op(L))<0 then > 0: > elif L=[0$k] then > 1: > else > add(NuW([op(1..i-1,L),L[i]-1,op(i+1..k,L)]),i=1..k): > fi: > > end: > ID := [1,7,9,0,0,7,5,2,1] ID := [1, 7, 9, 0, 0, 7, 5, 2, 1] ; > sort(ID) [0, 0, 1, 1, 2, 5, 7, 7, 9] ; > F := [2,2,1,1,2,1] F := [2, 2, 1, 1, 2, 1] ; > NuW(F) 45360 ; > #Answer: there are 45360 ways to rearrange my RUID ;