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 #171: Finding numbers for which the sum of the squares of the digits is a square

Project Euler #171: Finding numbers for which the sum of the squares of the digits is a square

Problem
Submissions
Leaderboard
Discussions

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

For a positive integer , let be the sum of the squares of the digits (in base ) of , e.g.

,
,

Find the sum of all , , such that is a perfect square modulo .

Input Format

The first line of input contains the only integer .

Constraints

Output Format

Output the only integer which is the answer for the problem.

Sample Input 0

100

Sample Output 0

826

Explanation 0

You have to sum up following numbers: .

Author

adamant

Difficulty

Medium

Max Score

100

Submitted By

1628

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