• + 0 comments
    public static int getTotalX(List<int> a, List<int> b)
        {
        
            List<int> GetFactoresMutuos()
            {
                var max = b.Min(x => x);
                List<int> factores = new List<int>();
                for (int i = 1; i <= max; i++)
                {
                    if(b.All(el => el % i == 0))
                        factores.Add(i);
                }
    
                return factores;
            }
    
            List<int> GetPossiveisR(List<int> factoresParaTestar)
            {
                return factoresParaTestar.Where(f => a.All(elA => f % elA == 0)).ToList() ;
            }
    
            var fatores = GetFactoresMutuos();
            var possivesR = GetPossiveisR(fatores);
    
            return possivesR.Count();
        }