Write a function largest_prime_factor(n) that takes a positive integer n as input and returns the largest prime factor of n. A prime factor is a factor that is a prime number. For example, the largest prime factor of 12 is 3.

Solution Stats

82 Solutions

1 Solvers

Last Solution submitted on Nov 06, 2025

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Problem Recent Solvers1

Suggested Problems

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!