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 #119: Digit power sum

Project Euler #119: Digit power sum

Problem
Submissions
Leaderboard
Discussions

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

We shall call a positive integer "interesting" if it contains at least two digits when written in base and is equal to the sum of its digits raised to some power.

For example, if , numbers and are "interesting".

For a given base , find all "interesting" numbers below .

Input Format

The input contains one integer .

Constraints

Output Format

Print one line containing all the "interesting" numbers for base in ascending order. The numbers should be printed in decimal numeral system.

Sample Input

10

Sample Output

81 512 2401 4913 5832 17576 19683 234256 390625 614656 1679616 17210368 34012224 52521875 60466176 205962976 612220032 8303765625 10460353203 24794911296 ...

Explanation

Only the first twenty numbers are shown in the "Sample output", the actual output contains numbers.

Author

Alex_2oo8

Difficulty

Easy

Max Score

100

Submitted By

764

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