#P12338. Smart Pulse Generator Optimization

    ID: 14437 Type: Default 1000ms 256MiB

Smart Pulse Generator Optimization

Smart Pulse Generator Optimization

In the Blue Bridge Electronic Workshop, engineer Xiaolan is designing a smart pulse generator that drives a new type of device. The operation of the device depends on a specific pulse intensity, represented by a positive integer \(p\), which must satisfy the following three conditions:

  1. It can be expressed as the sum of 10 consecutive positive integers, i.e., there exists a positive integer \(k\) such that \[ p = k + (k+1) + (k+2) + \cdots + (k+9) = 10k + 45. \]
  2. All digits of \(p\) are identical. For example, numbers like 1111, 22222, 333333, etc.
  3. \(p\) does not exceed 20255202, that is, \(1 \leq p \leq 20255202\).

Since the sum of 10 consecutive numbers is given by \(10k+45\), and a repdigit number with all digits the same must end with that same digit, the only possibility is that \(p\) is composed entirely of the digit 5. In other words, \(p\) must be of the form \[ p=5\times\frac{10^n-1}{9} \] for some integer \(n\). Moreover, to satisfy \(p=10k+45\) with \(k\geq1\), the minimal possible value of \(p\) should be at least 55. By checking for increasing values of \(n\), we find that the valid pulse intensities are:

  • For \(n=2\): \(p = 55\)
  • For \(n=3\): \(p = 555\)
  • For \(n=4\): \(p = 5555\)
  • For \(n=5\): \(p = 55555\)
  • For \(n=6\): \(p = 555555\)
  • For \(n=7\): \(p = 5555555\)

Your task is to compute the sum of all such valid pulse intensities.

inputFormat

This problem does not require any input.

outputFormat

Output a single integer, which is the sum of all valid pulse intensities \(p\) that satisfy the conditions.

sample

No input
6172830