Multiples of seven

For every natural n, let X(n) be the smallest natural m such that m ends
with n and m is a multiple of 7. For instance, X(1) = 21, X(2) = 42,
X(3) = 63, …, X(7) = 7, X(8) = 28, X(9) = 49, X(10) = 210, X(11) = 511,
… Let S be the infinite concatenation of X(i) for every i ≥ 1, that is,
S = 21426314355672849210511.... Which is the i-th digit of S?

Input

Input consists of several cases, each with a natural i between 1 and
10¹⁵.

Output

For every i, print the i-th digit of S (starting at one).

Problem information

Author: Salvador Roura

Generation: 2026-01-25T11:55:25.375Z

© Jutge.org, 2006–2026.
https://jutge.org
