A237766 Least initial number of n consecutive integers that are not divisible by any of their nonzero digits.
23, 37, 56, 56, 866
Offset: 1
Examples
23 is the first number that is not divisible by either of its digits. 37 and 38 are the first two consecutive numbers that are not divisible by any of their digits. Thus, a(2) = 37. 56, 57, 58 (and 59) are the first three (and four) consecutive numbers that are not divisible by any of their digits. Thus, a(3) = a(4) = 56. 866, 867, 868, 869, and 870 are the first five consecutive numbers that are not divisible by any of their digits. Thus, a(5) = 866.
Programs
-
Python
def DivDig(x): total = 0 for i in str(x): if i != '0': if x/int(i) % 1 == 0: return True return False def Nums(x): n = 1 while n < 10**3: count = 0 for i in range(n,n+x): if not DivDig(i): count += 1 else: break if count == x: return n else: n += 1 x = 1 while x < 10: print(Nums(x)) x += 1
Comments