What's this constructed number's starter? A number of programming languages construct large integers through 'concatenating' the digit to the end of the existing number. For example, Labyrinth, or Adapt. By concatenating the digit to the end, I mean that, if the existing number is \$45\$, and the digit is \$7\$, the result number is \$457\:(45 \times 10 + 7)\$.

A constructed number is a number that can be built this way through the use of the multiples of single digit numbers: \$1, 2, 3, 4, 5, 6, 7, 8, 9\$ A.K.A an element in one of these 9 sequences:

$$1, 12, 123, 1234, 12345, \: \dots$$
$$2, 24, 246, 2468, 24690, \: \dots$$
$$3, 36, 369, 3702, 37035, \: \dots$$
$$4, 48, 492, 4936, 49380, \: \dots$$
$$5, 60, 615, 6170, 61725, \: \dots$$
$$6, 72, 738, 7404, 74070, \: \dots$$
$$7, 84, 861, 8638, 86415, \: \dots$$
$$8, 96, 984, 9872, 98760, \: \dots$$
$$9, 108, 1107, 11106, 111105, \: \dots$$

To provide an example of how the sequences are constructed, here's how the sequence for \$a = 3\$ in constructed:

$$\begin{align}
u_1 = &amp;&amp; a = &amp;&amp; 3 &amp; = 3\\
u_2 = &amp;&amp; 10 \times u_1 + 2 \times a = &amp;&amp; 30 + 6 &amp; = 36 \\
u_3 = &amp;&amp; 10 \times u_2 + 3 \times a = &amp;&amp; 360 + 9 &amp; = 369 \\
u_4 = &amp;&amp; 10 \times u_3 + 4 \times a = &amp;&amp; 3690 + 12 &amp; = 3702 \\
u_5 = &amp;&amp; 10 \times u_4 + 5 \times a = &amp;&amp; 37020 + 15 &amp; = 37035 \\
u_6 = &amp;&amp; 10 \times u_5 + 6 \times a = &amp;&amp; 370350 + 18 &amp; = 370368 \\
\end{align}$$
$$\vdots$$
$$\begin{align}
u_{33} = &amp;&amp; 10 \times u_{32} + 33 \times a = &amp;&amp; 37\dots260 + 99 &amp; = 37\dots359 \\
u_{34} = &amp;&amp; 10 \times u_{33} + 34 \times a = &amp;&amp; 37\dots359 + 102 &amp; = 37\dots3692
\end{align}$$
$$\vdots$$

\$u_{33}\$ and \$u_{34}\$ included to demonstrate when \$n \times a \ge 100\$. A lot of digits dotted out for space.

It may still not be clear how these sequences are constructed, so here are two different ways to understand them:


Each sequence starts from the single digit. The next term is found by taking the next multiple of that digit, multiplying the previous term by \$10\$ and adding the multiple. In sequence terms:

$$u_n = 10 \times u_{n-1} + n \times a,  \: \: u_1 = a$$

where \$a\$ is a single digit (\$1\$ through \$9\$)





Each of the \$9\$ elements at any point in the sequence (take \$n = 3\$ for instance) are the multiples of \$123\dots\$ from \$1\$ to \$9\$, where \$123\dots\$ is constructed by \$u_{n+1} = 10 \times u_n + n\$ \$(1, 12, 123, \dots, 123456789, 1234567900, 12345679011, \dots)\$

So the first values are \$1 \times 1, 2, 3, \dots, 8, 9\$, the second are \$12 \times 1, 2, 3, \dots, 8, 9\$, the third \$123 \times 1, 2, 3, \dots, 8, 9\$, etc.


Your task is to take a constructed number as input and to output the initial digit used to construct it. You can assume the input will always be a constructed number, and will be greater than \$0\$. It may be a single digit, which maps back to itself.

You may take input in any reasonable manner, including as a list of digits, as a string etc. It is acceptable (though not recommended) to take input in unary, or any other base of your choosing.

This is a code-golf so the shortest code wins!

Test cases

       u_n        =&gt; a
 37035            =&gt; 3
 6172839506165    =&gt; 5
 5                =&gt; 5
 246913580244     =&gt; 2
 987654312        =&gt; 8
 61728395061720   =&gt; 5
 1111104          =&gt; 9
 11111103         =&gt; 9
 111111102        =&gt; 9
 2469134          =&gt; 2
 98760            =&gt; 8
 8641975308641962 =&gt; 7


or as two lists:

[37035, 6172839506165, 5, 246913580244, 987654312, 61728395061720, 1111104, 11111103, 111111102, 2469134, 98760, 8641975308641962]
[3, 5, 5, 2, 8, 5, 9, 9, 9, 2, 8, 7]




When I posted this challenge, I didn't realise it could be simplified so much by the method used in Grimmy's answer, and so therefore would be very interested in answers that take a more mathematical approach to solving this, rather than a 'digit' trick (Obviously all valid answers are equally valid, just what I'd be interested in seeing).
05AB1E, 7 5 4 bytes

&gt;9*н


Try it online!

&gt;            # input + 1
 9*          # * 9
   н         # take the first digit


The \$(n-1)^{th}\$ term of the sequence starting with \$a\$ is \$\sum _{i=1}^{n-1} a \times i \times 10^{i-1} = a \times \frac{(10^n - 1) / 9 - n}{9}\$. Multiply that by \$9\$ and add \$a\times n\$, and you get \$a \times \frac{10^n - 1}{9}\$, aka the digit \$a\$ repeated \$n\$ times. Turns out adding \$9\$ instead of \$a\times n\$ works for \$n=1\$, and for bigger \$n\$ the linear difference is negligible next to the exponential growth.