A335305 details for n=7. The below show the different ways of creating a closed loop for n=7 given the first step is of length 1 to the right and the next non-right step is upward. There are 84 different closed loops paths. The number to the right of the loop indicates the number of different ways that loop can be walked. If no number is shown then the walk can be taken in two ways. Two ways result as, other than the rectangular paths, each path has six sides, so one of those sides will be composed of two steps. These two steps can be taken in either order, giving two ways for the path to be walked. Some of the paths can be taken in four ways as the loop has two sides of length 7 - one is the step of length 7 while the other is composed of two steps of combined length 7, for example 3 and 4. The shorter steps can be taken in either order, while those steps can be swapped with the single step of length 7, given a total of four combinations in all. The non-square rectangular paths have three legs with two pairs, both steps can be swapped, and the right and left edge pairs can also be swapped to the other side, giving total combinations of (2*2*2) * 2 = 16. The single perfect square has three sides where the pairs can be swapped, but also the right,left and top edge can be walked in any order, giving total combinations of (2*2*2)*3! = 48; The total number of loops, including different step combinations, for the configurations shown below is 96+36+60+24+72 = 288. Each of these can also be created with a walk starting with a first step of length 2 to 7 to the right, with the next non-right step being upward, so the total number when all first steps are considered is 288*7 = 2016. On the 2D square lattice the first step can be in one of four directions, and the next step not in the same direction can be either up/down or left/right, so there are 8 different ways in all. This gives the final total number of ways in which a loop of seven steps can be created, with step-lengths 1 to 7 and where the steps can be taken in any order, as 2016*8 = 16128. Key: 'X' marks the start of the walk, which is followed by a first step of length 1 to the right then a next non-right step being upward. '+' marks the end of each step of length 1..n. '*' marks the unit lengths along each step. '-' or '|' mark the unit step lengths in the given direction. ========================================================================================== 4 types for rectangle. Total = 16+48+16+16 = 96 +---*---*---*---*---+---*---*---+ | | * * | | * * | | * * 16 | | * + | | * * | | +---*---*---*---*---*---*---X---+ +---*---*---*---+---*---*---+ | | * * | | * * | | * * | | 48 * * | | * + | | * * | | +---*---*---*---*---*---X---+ +---*---*---*---*---+ | | * * | | * * | | + * | | * * | | 16 * * | | * * | | * + | | * * | | +---*---*---*---X---+ +---*---*---+ | | * * | | * * | | * * | | * * | | + * | | 16 * * | | * + | | * * | | * * | | * * | | X---+---*---+ =================================== 14 types for lower-left corner removed. Total = 10*2+4*4 = 36 +---*---*---*---*---+ | | * * | | +---*---*---*---+ * | | * * | | * * | | * * | | * + | | * * | | * * | | X---+ +---*---*---+ | | * * | | * * | | * * | | +---*---+ * | | * * | | * + | | * * | | * * | | * * | | * * | | X---+ +---*---*---*---*---+ | | * * | | * * | | +---*---*---*---+ * | | * * | | * * | | * * | | * + | | * * | | X---+ +---*---*---+ | | * * | | * * | | * * | | * * | | +---*---+ * | | * * | | * + | | * * | | * * | | * * | | X---+ +---*---*---*---*---*---*---+ | | * * | | +---*---*---*---*---*---+ * | | * * | | 4 * + | | * * | | * * | | X---+ +---*---*---+ | | * * | | * * | | * * | | * * | | * * | | +---*---+ * | | * + | | * * | | * * | | * * | | X---+ +---*---*---*---*---+---*---*---+ | | * * | | +---*---*---*---*---*---*---+ * | | * * | | * * | | * * | | X---+ +---*---*---*---*---*---*---+ | | * * | | * * | | +---*---*---*---*---*---+ * 4 | | * * | | * + | | * * | | X---+ +---*---*---+ | | * * | | * * | | * * | | * * | | * * | | * + | | +---*---+ * | | * * | | * * | | * * | | X---+ +---*---*---*---*---*---*---+ | | * * | | * * | | * * | | 4 +---*---*---*---*---*---+ * | | * + | | * * | | X---+ +---*---*---*---*---+ | | * * | | * * | | * * | | * * | | * * | | +---*---*---*---+ * | | * + | | * * | | X---+ +---*---*---*---*---+---*---*---+ | | * * | | * * | | * * | | +---*---*---*---*---*---*---+ * | | * * | | X---+ +---*---*---*---*---*---*---+ | | * * | | * * | | * * 4 | | * + | | +---*---*---*---*---*---+ * | | * * | | X---+ +---*---*---*---*---+ | | * * | | * * | | * * | | * * | | * * | | * + | | +---*---*---*---+ * | | * * | | X---+ =================================== 26 types for upper-left corner removed. Total = 22*2+4*4 = 60. +---*---+ | | * * | | * * | | * * | | X---+ * | | * + | | * * | | * * | | * * | | * * | | * * | | +---*---*---+ +---*---*---*---+ | | * * | | X---+ * | | * + | | * * | | * * | | * * | | * * | | * * | | +---*---*---*---*---+ +---*---+ | | * * | | * * | | * * | | * + | | X---+ * | | * * | | * * | | * * | | * * | | * * | | +---*---*---+ +---*---*---*---+ | | * * | | * + | | X---+ * | | * * | | * * | | * * | | * * | | * * | | +---*---*---*---*---+ +---*---*---+ | | * * | | +---*---*---*---+ * | | * * | | * * | | * * | | * * | | X---+---*---*---*---*---*---+ +---*---*---*---+ | | * * | | +---*---*---+ * | | * * | | * * | | * * | | * * | | X---+---*---*---*---*---*---+ +---*---+ | | * * | | * * | | * * | | * + | | * * | | X---+ * | | * * | | * * | | * * | | * * | | +---*---*---+ +---*---*---*---*---*---+ | | * * | | X---+ * | | * + | | 4 * * | | * * | | * * | | +---*---*---*---*---*---*---+ +---*---+ | | * * | | * * | | +---*---*---*---*---+ * | | * * | | * * | | * * | | X---+---*---*---*---*---*---+ +---*---*---+ | | * * | | +---*---*---*---*---+ * | | * * | | * * | | * * | | +---*---*---*---*---*---*---X---+ +---*---*---*---*---+ | | * * | | +---*---*---+ * | | * * | | * * | | * * | | +---*---*---*---*---*---*---X---+ +---*---*---*---*---+ | | * * | | * * | | +---*---+ * | | * * | | * * | | * * | | X---+---*---*---*---*---*---+ +---*---+ | | * * | | * * | | * * | | * * | | * + | | * * | | X---+ * | | * * | | * * | | * * | | +---*---*---+ +---*---*---*---*---*---+ | | * * | | * + | | X---+ * | | 4 * * | | * * | | * * | | +---*---*---*---*---*---*---+ +---*---*---*---*---*---*---+ | | * * | | X---+ * | | * * | | * * | | * * | | +---*---*---*---*---+---*---*---+ +---*---+ | | * * | | * * | | * * | | +---*---*---*---*---+ * | | * * | | * * | | X---+---*---*---*---*---*---+ +---*---*---*---*---+ | | * * | | * * | | * * | | +---*---+ * | | * * | | * * | | X---+---*---*---*---*---*---+ +---*---*---*---+ | | * * | | * + | | * * | | * * | | * * | | X---+ * | | * * | | * * | | +---*---*---*---*---+ +---*---*---*---*---*---+ | | * * | | * + | | * * | | X---+ * 4 | | * * | | * * | | +---*---*---*---*---*---*---+ +---*---*---+ | | * * | | * * | | * * | | +---*---*---*---*---+ * | | * * | | +---*---*---*---*---*---*---X---+ +---*---*---+ | | * * | | * * | | * * | | * * | | +---*---*---*---+ * | | * * | | X---+---*---*---*---*---*---+ +---*---*---*---+ | | * * | | * * | | * * | | * * | | +---*---*---+ * | | * * | | X---+---*---*---*---*---*---+ +---*---*---*---*---+ | | * * | | * * | | * * | | +---*---*---+ * | | * * | | +---*---*---*---*---*---*---X---+ +---*---*---*---+ | | * * | | * * | | * + | | * * | | * * | | * * | | X---+ * | | * * | | +---*---*---*---*---+ +---*---*---*---*---*---+ | | * * | | * * | | * + | | 4 * * | | X---+ * | | * * | | +---*---*---*---*---*---*---+ +---*---*---*---*---*---*---+ | | * * | | * * | | * * | | X---+ * | | * * | | +---*---*---*---*---+---*---*---+ ====================================== 12 types for upper-left corner removed. Total = 12*2 = 24. +---*---*---*---*---+ | | * * | | * * | | * * | | * +---*---*---+ | | * * | | +---*---*---*---*---*---*---X---+ +---*---*---*---*---+ | | * * | | * * | | * * | | * +---*---+ | | * * | | * * | | +---*---*---*---*---*---X---+ +---*---*---*---*---+ | | * * | | * * | | * +---*---+ | | * * | | * * | | * * | | +---*---*---*---*---*---X---+ +---*---*---*---*---+ | | * * | | * +---*---*---+ | | * * | | * * | | * * | | +---*---*---*---*---*---*---X---+ +---*---*---*---+ | | * * | | * * | | * * | | * * | | * +---*---*---+ | | * * | | +---*---*---*---*---*---X---+ +---*---*---*---+ | | * * | | * +---*---*---+ | | * * | | * * | | * * | | * * | | +---*---*---*---*---*---X---+ +---*---*---+ | | * * | | * * | | * * | | * * | | * +---*---*---*---+ | | * * | | +---*---*---*---*---*---X---+ +---*---*---+ | | * * | | * * | | * * | | * +---*---*---*---*---+ | | * * | | +---*---*---*---*---*---*---X---+ +---*---*---+ | | * * | | * +---*---*---*---+ | | * * | | * * | | * * | | * * | | +---*---*---*---*---*---X---+ +---*---*---+ | | * * | | * +---*---*---*---*---+ | | * * | | * * | | * * | | +---*---*---*---*---*---*---X---+ +---*---+ | | * * | | * * | | * * | | * +---*---*---*---*---+ | | * * | | * * | | +---*---*---*---*---*---X---+ +---*---+ | | * * | | * * | | * +---*---*---*---*---+ | | * * | | * * | | * * | | +---*---*---*---*---*---X---+ ====================================== 28 types for lower-right corner removed. Total = 20*2+8*4 = 72. +---*---*---*---*---+---*---*---+ | | * * | | * X---+ | | * * | | * * | | * * | | +---*---*---*---*---*---*---+ +---*---*---*---*---+---*---*---+ | | * * | | * * | | * * | | * X---+ | | * * | | +---*---*---*---*---*---*---+ +---*---*---*---+---*---*---+ | | * * | | * X---+ | | * * 4 | | * * | | * * | | * * | | +---*---*---*---*---*---+ +---*---*---*---*---+---*---+ | | * * | | * * | | * X---+ 4 | | * * | | * * | | * * | | +---*---*---*---*---*---+ +---*---*---*---*---+---*---+ | | * * | | * * | | * * 4 | | * X---+ | | * * | | * * | | +---*---*---*---*---*---+ +---*---*---*---+---*---*---+ | | * * | | * * | | 4 * * | | * * | | * X---+ | | * * | | +---*---*---*---*---*---+ +---*---*---*---*---+ | | * * | | * X---+ | | + * | | * * | | * * | | * * | | * * | | * * | | +---*---*---*---+ +---*---*---*---*---+ | | * * | | + * | | * X---+ | | * * | | * * | | * * | | * * | | * * | | +---*---*---*---+ +---*---*---*---*---+ | | * * | | + * | | * * | | * * | | * * | | * X---+ | | * * | | * * | | +---*---*---*---+ +---*---*---*---*---+ | | * * | | * * | | + * | | * * | | * * | | * * | | * X---+ | | * * | | +---*---*---*---+ +---*---*---+ | | * * | | * * | | * * | | * X---+ | | + * | | * * | | * * | | * * | | * * | | * * | | +---*---+ +---*---*---+ | | * * | | * * | | * * | | + * | | * X---+ | | * * | | * * | | * * | | * * | | * * | | +---*---+ +---*---*---+ | | * * | | * * | | * * | | + * | | * * | | * X---+ | | * * | | * * | | * * | | * * | | +---*---+ +---*---*---+ | | * * | | * * | | * * | | * * | | + * | | * * | | * X---+ | | * * | | * * | | * * | | +---*---+ +---*---*---*---*---+ | | * * | | * +---*---*---*---+ | | + * | | * * | | * * | | * * | | * * | | * * | | X---+ +---*---*---+ | | * * | | * * | | * * | | * +---*---+ | | + * | | * * | | * * | | * * | | * * | | * * | | X---+ +---*---*---*---*---+ | | * * | | + * | | * +---*---*---*---+ | | * * | | * * | | * * | | * * | | * * | | X---+ +---*---*---+ | | * * | | * * | | * * | | + * | | * +---*---+ | | * * | | * * | | * * | | * * | | * * | | X---+ +---*---*---*---+---*---*---+ | | * * | | * +---*---*---*---*---*---+ | | * * | | 4 * * | | * * | | * * | | X---+ +---*---*---+ | | * * | | * * | | * * | | + * | | * * | | * +---*---+ | | * * | | * * | | * * | | * * | | X---+ +---*---*---*---*---+---*---*---+ | | * * | | * +---*---*---*---*---*---*---+ | | * * | | * * | | * * | | X---+ +---*---*---*---*---+---*---+ | | * * | | 4 * * | | * +---*---*---*---*---*---+ | | * * | | * * | | * * | | X---+ +---*---*---+ | | * * | | * * | | * * | | * * | | + * | | * * | | * +---*---+ | | * * | | * * | | * * | | X---+ +---*---*---*---*---+---*---+ | | * * | | * * 4 | | * * | | * +---*---*---*---*---*---+ | | * * | | * * | | X---+ +---*---*---*---*---+ | | * * | | + * | | * * | | * * | | * * | | * +---*---*---*---+ | | * * | | * * | | X---+ +---*---*---*---*---+---*---*---+ | | * * | | * * | | * * | | * +---*---*---*---*---*---*---+ | | * * | | X---+ +---*---*---*---+---*---*---+ | | * * | | * * | | * * 4 | | * * | | * +---*---*---*---*---*---+ | | * * | | X---+ +---*---*---*---*---+ | | * * | | * * | | + * | | * * | | * * | | * * | | * +---*---*---*---+ | | * * | | X---+