public static string LexicographicPermutations(int n, int k) { List <int> nums = new List <int>(); for (int i = 0; i <= n; i++) { nums.Add(i); } //IEnumerable<IEnumerable<int>> numper = CombinatoricFunctions.GetPermutations(nums, n+1); IEnumerable <IEnumerable <int> > numper = SomeExtensions.GetPermutations(nums); List <List <int> > list = numper.Select(c => c.ToList()).ToList(); return(MiscFunctions.ListToString(list[k - 1])); }
public static long SubstringDivisibility() { long sum = 0; var perm = SomeExtensions.GetPermutations(nums); List <List <int> > list = FileFunctions.ienumtolist(perm); foreach (List <int> num in list) { if (SubStringTest(num)) { sum += MiscFunctions.ListToLong(num); } } return(sum); }