N is a five-digit base ten positive integer formed entirely by nonzero digits.
Find the total number of values of N such that such that deleting consecutively the digit of the left, in each step, we obtain a divisor of the previous number.
For n = 11111 To 99999
ns = Str$(n)
If InStr(ns, "0") = 0 Then
prev = n
good = 1
For i = 1 To 4
ns = Mid(ns, 2)
newn = Val(ns)
If prev Mod newn <> 0 Then
good = 0: Exit For
End If
prev = newn
Next
If good Then Text1.Text = Text1.Text & Str(n) & crlf: goodCt = goodCt + 1
End If
Next
finds
53125
91125
95625
3
so there are 3 such values.
|
Posted by Charlie
on 2015-04-22 14:20:58 |