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 #80: Square root digital expansion

Project Euler #80: Square root digital expansion

Problem
Submissions
Leaderboard
Discussions

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

It is well known that if the square root of a natural number is not an integer, then it is irrational. The decimal expansion of such square roots is infinite without any repeating pattern at all.

The square root of two is , and the digital sum of the first one hundred decimal digits is .

For the first natural numbers, find the total of the digital sums of the first digits for all the irrational square roots x such that .

Input Format

First line contains and second line contains

Constraints

Constraints 1

Constraints 2

Output Format

Print the required digit sum as asked.

Sample Input

2
100

Sample Output

475

Author

shashank21j

Difficulty

Easy

Max Score

100

Submitted By

1089

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
  • Request a Feature