title: Count the number of beautiful numbers
body: <p>I found an interesting problem on the Internet:</p>
  <p><em>You need to count the number of beautiful (the sum of the first six numbers is equal to the sum of the last six digits) 13-digit numbers in the 13-digit number system, for example: the number 0055237050A00 is beautiful, since 0 + 0 + 5 + 5 + 2 + 3 = 0 + 5 + 0 + A + 0 + 0, and the number 1234AB988BABA is ugly, since 1 + 2 + 3 + 4 + A + B! = 8 + 8 + B + A + B + A</em></p>
  <p>I decided to write a class for this, which will store the number in the form converted to an array:</p>
  <pre><code>struct Number
  {
      explicit Number(size_t number);
      Number&amp; operator ++ ();
      Number&amp; operator ++ (int);
      bool is_beautiful() const;
  private:
      std::array&lt;uint8_t, 13&gt; m_digits;
  };
  </code></pre>
  <p>And then, in a loop, check all the numbers in the interval:</p>
  <pre><code>Number number{ 0u };
  size_t count_numbers = 0u;
  for (size_t i = 0u; i &lt; std::pow(13,13); ++i) {
      count_numbers |= (number++).is_beautiful();
  }
  </code></pre>
  <p>But I wanted to ask if this is the optimal solution, maybe you can somehow do without an array using arithmetic? If so, how then can this be implemented?</p>
  <p>Maybe there is some special algorithm to solve this problem</p>