#OK to post homework #William Wang, 10/25/2020, Assignment 15 #1. RoG := proc(k, n) local V, E, i, j, T1, v, Neighs, Moves, m, pt: 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 to nops(V) do pt := V[i]: Moves := {[-7, 0], [-6, 0], [-5, 0], [-4, 0], [-3, 0], [-2, 0], [-1, 0], [0, -7], [0, -6], [0, -5], [0, -4], [0, -3], [0, -2], [0, -1], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0]}: 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: seq(nops(SAW(RoG(3, n)[1])), n = 1 .. 5); 2, 6, 96, 3132, 252240 #This sequence is not in the OEIS #2. #The number of ways of walking from [0,0] to [40,40] with atomic steps {[1,0],[0,1],[1,1],[2,2]} NuW([40, 40], {[0, 1], [1, 0], [1, 1], [2, 2]}); 2382564832244243056285491057263 #The number of ways of walking from [0,0) to [40,40] with atomic steps {[1,0],[0,1],[1,1],[2,2]} that never go above x=y NuGW([40, 40], {[0, 1], [1, 0], [1, 1], [2, 2]}); 89322096703094945357683861273 #3. #The first 20 terms of the sequence enumerating walks from [0,0,0] to [n,n,n] with atomic steps {[1,0,0],[0,1,0],[0,0,1],[1,1,1]} SeqW({[0, 0, 1], [0, 1, 0], [1, 0, 0], [1, 1, 1]}, 20); [7, 115, 2371, 54091, 1307377, 32803219, 844910395, 22188235867, 591446519797, 15953338537885, 434479441772845, 11927609772412075, 329653844941016785, 9163407745486783435, 255982736410338609931, 7181987671728091545787, 202271071826031620236525, 5715984422606794841997001, 162016571360163769411597081, 4604748196249289767697705221] #The first 20 terms of the sequence enumerating walks from [0,0,0] to [n,n,n] with atomic steps {[1,0,0],[0,1,0],[0,0,1],[1,1,1]} that stay in x>=y>=z SeqGW({[0, 0, 1], [0, 1, 0], [1, 0, 0], [1, 1, 1]}, 20); [2, 10, 88, 1043, 14778, 236001, 4107925, 76314975, 1491934038, 30389576308, 640286048416, 13877540824735, 308102204007536, 6983346070924707, 161156356282624227, 3778249609096250059, 89826197363219012470, 2162338803354415120414, 52637415804379149938876, 1294313658632145337351381]