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 #183: Maximum product of parts

Project Euler #183: Maximum product of parts

Problem
Submissions
Leaderboard
Discussions

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

Let be a positive integer and let be split into equal parts, , so that .

Let be the product of these parts, .

For example, if is split into five equal parts, , then .

Let for a given value of .

It turns out that the maximum for is found by splitting eleven into four equal parts which leads to ; that is, , which is a terminating decimal.

However, for the maximum is achieved by splitting it into three equal parts, so , which is a non-terminating decimal.

Let if is a non-terminating decimal and if is a terminating decimal.

For example, for is .

Find for .

Input Format

The first line of each test file contains which is the number of test cases. lines follow, each containing the number for a given test case.

Constraints

Output Format

Print exactly lines with a single integer on each line i.e. the answer to the corresponding test.

Sample Input 0

1
100

Sample Output 0

2438

Author

bayleef

Difficulty

Easy

Max Score

100

Submitted By

656

Need Help?


View discussions
View top submissions

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy