A positive integer less than 30 million is such that if we subtract 5 from it – the resulting number is divisible by 8.
At the first step, from the number (considered originally) diminished by 5  we subtract the eighth part. We then obtain a number that also becomes divisible by 8 after 5 is subtracted from it.
At the second step, we derive another in the same way, namely by subtracting a eighth part from the number at the end of the first step diminished by 5. The resulting number is also divisible by 8 after subtracting 5.
The operation concludes at 8th step given that at the end of 7th step we get a number that is divisible by 8 after after subtracting 5.
Determine the positive integer initially before the first step.
*** The resulting number at the end of 8th step is NOT necessarily divisible by 8 after subtracting 5.
Starting with broll's 16777181
st = 16777181
For rpt = 1 To 8
newone = (st  5) * 7 / 8
Text1.Text = Text1.Text & newone & crlf
st = newone
Next
we do get a valid sequence:
14680029 ... after first operation
12845021
11239389
9834461
8605149
7529501
6588309
5764766 ... after 8th operation
Starting with Ady's numbers:
From 11,983,725
10485755
9175031.25
8028147.96875
7024625.09765625
6146542.58544922
5378220.38726807
4705938.46385956
4117691.78087711
From 28,760,941
25165819
22020087.25
19267571.96875
16859121.0976563
14751726.5854492
12907756.3872681
11294282.4638596
9882492.78087711
all with nonintegral values.
I believe Ady made the same mistake I made: dividing by 8 rather than multiplying by 7/8 at each step after subtracting 5. I retracted that wrong solution. If one made that wrong choice, the one would indeed get
1497965
187245
23405
2925
365
45
5
0
or
3595117
449389
56173
7021
877
109
13
1
respectively.

Posted by Charlie
on 20160407 10:41:07 