We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. All Contests
  2. ProjectEuler+
  3. Project Euler #3: Largest prime factor

Project Euler #3: Largest prime factor

Problem
Submissions
Leaderboard
Discussions

This problem is a programming version of Problem 3 from projecteuler.net

The prime factors of are and .

What is the largest prime factor of a given number ?

Input Format

First line contains , the number of test cases. This is followed by lines each containing an integer .

Constraints

Output Format

For each test case, display the largest prime factor of .

Sample Input 0

2
10
17

Sample Output 0

5
17

Explanation 0

  • Prime factors of are , largest is .
  • Prime factor of is itself, hence largest is .

Author

shashank21j

Difficulty

Easy

Max Score

100

Submitted By

41414

Need Help?


View discussions
View top submissions

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits

Choose a translation


  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy