Beispiel #1
0
        private static bool AnExplicitPairExists(int i)
        {
            int last  = new IndexableNumber(i)[1];
            var parts = new IndexableNumber(i).DigitsBase10().NotStupidSplit(x =>
            {
                // split on change
                bool flag = x != last;
                last      = x;
                return(flag);
            });
            var distinctParts = parts.DistinctBy(p => p.Aggregate(0, (acc, curr) => acc * 497 + curr));

            return(distinctParts.Any(p => p.Count() == 2));
        }