Find the largest prime number factor?

前端 未结 7 1758
别那么骄傲
别那么骄傲 2021-01-29 08:40

I need to find The prime factors of 13195 are 5, 7, 13 and 29. / * Largest is 377. * / What is the largest prime factor of the number 600851475143 ?

#include<         


        
相关标签:
7条回答
  • 2021-01-29 09:39
    1. 600851475143 is too big to fit in 32 bit integer. long may be 32 bit on your machine. You need to use 64 bit type. The exact data type will be dependent on your platform, compiler.

    2. Your prime checking code is wrong. You are assuming that if something is not devided by 2, 3, 5, 7 then that is prime.

    0 讨论(0)
提交回复
热议问题