The problem is not stated clearly.
Are we concerned with the last (rightmost) digit?The sequence can start with any number (or so I think).
The pattern is: add 7 ... but if the last number is 2, 1 or 0, add 17.
. . or the last two digits? . . . or what?
If we are interested in only the last (rightmost) digit,
. . then the above condition is redundant, isn't it?
Whatever the last digit, we add 7.
The cycle repeats itself every ten digit.
If we are concerned with the last two-digits,
and we still have a ten-number repeating cycle.
So what was the question?