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 #56: Powerful digit sum

Project Euler #56: Powerful digit sum

Problem
Submissions
Leaderboard
Discussions

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

A googol is a massive number: one followed by one-hundred zeros. is almost unimaginably large: one followed by two-hundred zeros. Despite their size, the sum of the digits in each number is only 1.

Considering natural numbers of the form, , where , what is the maximum digital sum?

Input Format

Input contains an integer

Constraints

Output Format

Print the answer corresponding to the test case.

Sample Input

5

Sample Output

13

Explanation

and , which is the maximum digital sum for this range.

Author

shashank21j

Difficulty

Easy

Max Score

100

Submitted By

3710

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