# HW26 Spring 2024. Pablo Blanco. # NOT OK to post # 2. To compute these, I slightly modified the MakeTrM code from our proj5.txt (unpublished on the website). ## 2.1 ## M:=MakeTrM(1,1): M:=[seq([op(2..27,row)] ,row in M)]; M:=[seq(M[i],i=2..27)]; count := 0: for i from 1 to 26 do: for j from 1 to 26 do: if M[i][j] >= 1 then count++; fi: od: od: count; # Result: ##### 593 ###### ## 2.2 ## # Similarly, for 2.2: M:=MakeTrM(1,1): M:=[seq([op(2..27,row)] ,row in M)]; M:=[seq(M[i],i=2..27)]; count := 0: for i from 1 to 26 do: for j from 1 to 26 do: if M[i][j] >= 10 then count++; fi: od: od: count; # result: ############# 500 ############# ## 2.3 ## #restart: read(`counting.txt`): S:={}: for al from 1 to 26 do: for be from 1 to 26 do: S:=S union {[al,be]}: od: od: T:=MakeTrM(2,2): count := 0: for idx from 1 to 26 do: for lt in S do: if T[lt,idx] >= 1 then: count++: fi: od: od: count; #2.3. ######### 6639 ############