logo

Back to questions

Largest Prime Factor [Facebook Python Interview Question]

Medium

Given a target number, write a function to return the largest prime factor of that target number.

For example, for the number 42, the prime factors are 2, 3, and 7, so we'd return 7 because that's the largest prime factor.

For the number 25, it's prime factors are 5 and 5, so we'd return 5.

Python