#its ok to post #TaerimKim,10/31/2020,Assignment 15 #1.Using the methods from KiG and KtG RoG:=proc(k,n) local a, b, i, E, V, T1, pt, Moves, Neighs; V := [seq(seq(seq([i, j], j = 1 .. n), i = 1 .. k))]; for i to nops(V) do T1[V[i]] := i; od; E:=[]: for i from 1 to nops(V) do pt:=V[i]: Moves:={seq([a, 0], a = 1 .. k),seq([-a, 0], a = 1 .. k),seq([0, b], b = 1 .. n),seq([0, -b], b = 1 .. n)}; Neighs := {seq(pt + m, m in Moves)}; Neighs := Neighs intersect convert(V, set); E:=[op(E),{seq(T1[v],v in Neighs)}]: od: E,V: end: #now evaluate the first 4 terms of RoG(3,i) when i=1..4 seq(SAWnu(RoG(3, i)), i = 1 .. 4); 2, 6, 96, 3132 ############################################################################# #(With using the Comboprogect2.txt) #2. #total number of walks from [0,0] to [40,40] using these 4 atomic steps NuW([40, 40], {[0, 1], [1, 0], [1, 1], [2, 2]}); 2382564832244243056285491057263 #total number of walks that does not go over x=y(which always satisfy x>=y) NuGW([40, 40], {[0, 1], [1, 0], [1, 1], [2, 2]}); 89322096703094945357683861273 ############################################################################## #(With using the Comboprogect3.txt) #3. similar cases to the above seq(NuW([i, i, i], {[0, 0, 1], [0, 1, 0], [1, 0, 0], [1, 1, 1]}), i = 1 .. 20); 7, 115, 2371, 54091, 1307377, 32803219, 844910395, 22188235867, 591446519797, 15953338537885, 434479441772845, 11927609772412075, 329653844941016785, 9163407745486783435, 255982736410338609931, 7181987671728091545787, 202271071826031620236525, 5715984422606794841997001, 162016571360163769411597081, 4604748196249289767697705221 #under the condition that walks should satisfy (x>=y>=z) seq(NuGW([i, i, i], {[0, 0, 1], [0, 1, 0], [1, 0, 0], [1, 1, 1]}), i = 1 .. 20); 2, 10, 88, 1043, 14778, 236001, 4107925, 76314975, 1491934038, 30389576308, 640286048416, 13877540824735, 308102204007536, 6983346070924707, 161156356282624227, 3778249609096250059, 89826197363219012470, 2162338803354415120414, 52637415804379149938876, 1294313658632145337351381