Skip to content

Project Euler Problem 917 – Number Splitting

We define an S-number to be a natural number, \(n\), that is a perfect square and its square root can be obtained by splitting the decimal representation of n into 2 or more numbers then adding the numbers.

For example, 81 is an S-number because \(\sqrt{81} = 8 + 1\).
6724 is an S-number: \(\sqrt{6724} = 6 + 72 + 4\).
8281 is an S-number: \(\sqrt{8281} =8 + 2 + 81 = 82 + 8 + 1\).
9801 is an S-number: \(\sqrt{9801} = 98 + 0 + 1\).

Further we define \(T(N)\) to be the sum of all S numbers \(n ≤ N\).  You are given \(T(10^4) = 41333\).

Find \(T(10^{12})\).

One Comment Leave one →
  1. Brian Gladman permalink

    Every so often the Project Euler team slip in a relatively easy problem to encourage us lesser mortals to have a go at solving it. This one was one of these and is relatively easy to solve in Python. It is quite slow but gets the result in a few minutes.

    A great feature of Python is the ease with which a solution method can be coded and tested but the result is always going to lag what can be achieved by compiled code. Nevertheless, once a Python program has been developed and tested, it s often easy to translate it into C or C++ to gain a big speed increase.

Leave a Reply

Note: HTML is allowed. Your email address will not be published.

Subscribe to this comment feed via RSS