A249665 lists the number of permutations p of {1,...,n} such that p(1)=1, p(n)=n, and p(i)p(i+1) is in {1,2,3} for all i from 1 to n1.
The question can be generalized as 'Find the number of permutations p of {1,...,n} such that p(1)=1, p(n)=n, and p(i)p(i+1) is in some Set A for all i from 1 to n1'. Additional problems can be like ignoring the 'p(1)=1, p(n)=n' constraints. For example, A174700 and A249665.
The question is How to solve these class of problems in general? What theory does this in a best possible way? Is there any theory to handle this? If yes, can anyone kindly give me the source which shows the solution with examples?
I can't believe there is no general theory to solve this.
Any help is greatly appreciated. Thank You.
General Theory to solve a class of problems

 Posts: 470
 Joined: Sun Mar 22, 2015 2:30 pm
 Location: India
 Contact:
General Theory to solve a class of problems
It is not knowledge, but the act of learning, not possession but the act of getting there, which grants the greatest enjoyment.