> #Q1. THE FIRST ATTENDANCE QUESTION WAS: > #Let a:= FIRST DIGIT of your RUID ; > #Let b:= SECOND DIGIT of your RUID ; > #Let c:= 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 ; > my ruid is 179009929 ; > a:= 1; b:= 7; c:= 0; d:=9; Typesetting:-mprintslash([(a := 1)],[1]) Typesetting:-mprintslash([(b := 7)],[7]) Typesetting:-mprintslash([(c := 0)],[0]) Typesetting:-mprintslash([(d := 9)],[9]) ; > Fformula:=proc(m,n): (m+n)!/(m!*n!): end: > Fformula(max(a,b)-min(a,b),max(c,d)-min(c,d)); 5005 ; > ; > ; > ; > #Q2. Second attandance question ; > #condiser your ruid as a word of length 9 in ; > #the 10-letter ''alphabet' {0,1,2...9} ; > #how many ways to rearrange your ruid? ; > #my ruid is 179009929 ; > L := [1,7,9,0,0,9,9,2,9]; Typesetting:-mprintslash([(L := [1, 7, 9, 0, 0, 9, 9, 2, 9])],[[1, 7, 9, 0, 0, 9, 9, 2, 9]]) ; > sort(L); [0, 0, 1, 2, 7, 9, 9, 9, 9] ; > F:= [2,1,1,1,4]; Typesetting:-mprintslash([(F := [2, 1, 1, 1, 4])],[[2, 1, 1, 1, 4]]) ; > NuWformula:=proc(L) local k,i: > k:=nops(L): > > add(L[i],i=1..k)!/mul(L[i]!,i=1..k): > > end: > NuWformula(F); 7560 ; > ;