The prime factors of 13195 are 5, 7, 13 and 29.

What is the largest prime factor of the number 600851475143 ?

每个合数都可以写成几个质数相乘的形式。其中每个质数都是这个合数的因数,叫做这个合数的分解质因数。 分解质因数只针对合数。

c#代码:

class Program
    {
        static void Main(string[] args)
        {
            Int64 num = 600851475143;
            int prm = 2;
            while (prm < num)
            {
                if (num % prm == 0)
                    num /= prm;
                else prm += 1;
            }
            Console.WriteLine(prm);
        }
    }

如果有TC怎么办呢?

 

相关文章:

  • 2021-08-10
  • 2021-12-04
  • 2021-08-22
  • 2022-12-23
  • 2021-07-12
  • 2021-12-18
  • 2022-03-03
猜你喜欢
  • 2021-10-21
  • 2021-05-01
  • 2022-12-23
  • 2021-10-02
  • 2022-01-03
  • 2021-09-04
  • 2021-08-15
相关资源
相似解决方案