0

Again "pseudo-code" for C++ program. Quite primitive and simple, but I post it anyway. Generalized to take even even number as parameter.

Edited by pyTony: number > factor for 2

def biggest_factor(number):
    factor = 2
    while not (number % factor) and number > factor:
        number /= factor
    factor = 3
    limit = factor * factor
    while limit <= number:
        while not (number % factor) and number > factor:
            number /= factor
            #print factor,number
        limit += 4*(factor+1)
        factor += 2
    return number

print biggest_factor(600851475143)

Specialties:
IT/Science/Contracts/Religious translation/interpreting FIN-ENG-FIN
Python programming

1
Contributor
0
Replies
1
Views
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.