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

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. All Contests
  2. ProjectEuler+
  3. Project Euler #29: Distinct powers

Project Euler #29: Distinct powers

Problem
Submissions
Leaderboard
Discussions

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

Consider all integer combinations of for and :

If they are then placed in numerical order, with any repeats removed, we get the following sequence of 15 distinct terms:

How many distinct terms are in the sequence generated by for and ?

Input Format

Input contains an integer

Constraints

Output Format

Print the answer corresponding to the test case.

Sample Input

5

Sample Output

15

Author

shashank21j

Difficulty

Easy

Max Score

100

Submitted By

4347

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