# Permutations within a specific boundary

Let's have the following sequence of natural numbers: 1, 2, 3, 4, 5, 6, 7, 8. The permutations of these 8 numbers are equal to 8!. We can obtain some of these permutations by adding and subtracting one or more numbers within this sequence e.g. 8-1=7, 7+1=8, 6-1=5, 5+1=6, 4-1=3, 3+1=4, 2-1=1, 1+1=2; also we have 8-3=5, 7+1=8, 6-3=3, 5+1=6, 7-3=4, 6+1=7, 4-3=1, 1+1=2, and so on. My question is: how many permutations we can obtain with this method of adding and subtracting numbers within the sequence?

Every derangement of the ordered list $8,7,6,\cdots,2,1$ can be obtained by adding or subtracting one of the elements of $[8]:=\{1,\cdots,8\}$ to each entry of the list (with no restrictions on repetitions). This is because $(i,j)\mapsto |i-j|$ surjects from $[8]\times[8]\setminus\rm diag([8])$ onto $[8]$. If you disallow leaving a list entry fixed, these are all of the possible effects, whereas if you do allow entries to remain preserved, every possible permutation of the list is possible. It is unclear to me however what you are actually asking. – anon Nov 4 '12 at 3:59
@anon: If you look carefully at Vassilis’s examples, both follow the format $8-a$, $7+b$, $6-a$, $5+b$, $4-a$, $3+b$, $2-a$, $1+b$, where $a=b$ is permitted. He may be considering only modifications of this type. (And it seems perfectly clear that he’s using one-line notation with commas and without parentheses.) – Brian M. Scott Nov 4 '12 at 6:25