Community Problem

Beautiful Arrangement

Difficulty: Medium

Count the permutations of 1..n where every i either divides perm[i] or is divided by perm[i], using backtracking with divisibility pruning.