## math question

The question : I have a d-digit positive integer where each digit from 1 to d appears exactly once, and in which each digit (except for the leftmost) differs from one further to the left by +1 or -1. For example, if d = 3, the only numbers satisfying the conditions are, in increasing order, 123, 213, 231 and 321. Find a formula in terms of d for the number of integers satisfying these conditions. Taken from qbm033

## The answer isC(d - 1,0) +

The answer is C(d - 1,0) + C(d - 1,1) + C(d - 1,2) + ... + C(d - 1,d - 2) + C(d - 1,d - 1), where C(d-1,k) is the number of ways to select a subset of size k from a set of size d - 1.