Posts

Showing posts with the label largest prime factor

Largest prime factor | Project Euler | Problem #3

URL to the problem page:  https://projecteuler.net/problem=3 The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143? #include   <iostream> using   namespace   std ; int   main () {      long   long  number =  600851475143 , a, i, counter, j;      for  (i =  2 ; ; i++) {         a = number / i;         counter =  0 ;          if  (number % a ==  0 ) {              for  (j =  2 ; j <=  sqrt (a); j++) {                  if  (a...
My photo
Ercan Tomac
instagram.com/ercantomac