One of the most challenging problems in enumerative combinatorics is to count Wilf classes, where you are given a pattern, or set of patterns, and you are asked to find a “formula”, or at least an efficient algorithm, that inputs a positive integer n and outputs the number of permutations avoiding that pattern. F12345, Also to enumerate permutations containing exactly r occurrences of the pattern 12345 for r=0,1,2,3, ... but made more efficient for small r,