### algorithm

#### Numbers divisible by $n$ not having the digit $k$ in their representation

I want to write an efficient algorithm to retrieve the number of multiples of a number n in a given interval [a, b], that do not contain a certain digit k in their decimal representation, knowing that n, a, b can be very large (up to 1 Billion). Example : There are 89 numbers divisible by 1 in [0, 100] not containing 0 as a digit. All I first thought of is Digit Dynamic Programming but I don't know how It might be useful here.

Create function multiple(number n ,lowerbound a , upperbound b , digit k) IF a is not divisible by n Set a to its next multiple //(a += a - a % n) SET counter to ZERO while a is less than b IF (!isDigitPresent(a,k)) add one to counter END while print count Create function isDigitPresent(number n,digit k) WHILE n is not equal to 0 temp t is equal to n % 10 IF t is equal to k RETURN TRUE n = n / 10; ENDWHILE RETURN FALSE END FUNCTION This algorithm takes O(N) time in worst case.

### Related Links

extracting the first 32 bits of ASCII integer

Algorithm to optimally group list of values

How to compute value of i-th digit in a k-ary representation of a number?

Specifics, books or open source projects about p2p algorithms? [closed]

Big O runtime efficiency doubts

Postfix to Infix expression conversion algorithm [closed]

Serpentine algorithm [closed]

Cycles in a directed graph

This algorithm does not have a quadratic run time right?

How to sort/draw pseudo-3D buildings so as they don't visually overlap

Algorithm for sum-up to 0 from 4 set

Count inversions with merge-sort

checking Directed Graph for bridges

Explanation of parameters in earliest deadline first algorithm

animated gifs of (sorting) algorithms

Character generated from SHA-512 hash does not get saved to database