Multiples of seven P91736


Statement
 

pdf   zip

html

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 1015.

Output

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

Public test cases
  • Input

    1
    2
    3
    4
    13
    14
    15
    18
    19
    20
    1000000000000
    1000000000000000
    

    Output

    2
    1
    4
    2
    7
    2
    8
    2
    1
    0
    4
    5
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Official solutions
    C++
    User solutions
    C++