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.

Loading...

- All Contests
- ProjectEuler+
- Project Euler #80: Square root digital expansion

# Project Euler #80: Square root digital expansion

# Project Euler #80: Square root digital expansion

_{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
```