How many positive integers less than or equal to 123456 have a multiple that consists of all the same digits? (eg 101 works since 101 * 11 = 1111 which consists of only 1s)

To find the number of positive integers less than or equal to 123456 that have a multiple consisting of all the same digits, we can break down the problem into smaller cases.

First, we need to determine the range of numbers we need to consider. Since we are looking for positive integers less than or equal to 123456, our range for consideration is from 1 to 123456.

Next, we need to determine the pattern for the multiples that consist of all the same digits. The multiples consist of all the same digits if and only if the digit being multiplied is the same as the last digit of the resulting multiple.

For example:
- The multiple of 1 that consists of all the same digits is 111...1 (1 repeated multiple times).
- The multiple of 2 that consists of all the same digits is 222...2 (2 repeated multiple times).
- The multiple of 3 that consists of all the same digits is 333...3 (3 repeated multiple times).
- And so on...

From this pattern, we can see that there are only 9 possible multiples that consist of all the same digits (1, 2, 3, 4, 5, 6, 7, 8, 9).

Now, we can iterate through the range 1 to 123456 and check if the last digit of the multiple matches the digit being multiplied. If they match, we can increment a counter variable.

Here's the step-by-step process to get the solution:

1. Initialize a counter variable to 0, let's call it `count`.

2. Iterate through the range 1 to 123456 (inclusive):
- For each number `n` in the range, do the following steps:
- Convert `n` to a string.
- Get the last digit of `n` by indexing the string with [-1].
- Convert the last digit (string) back to an integer, let's call it `last_digit`.
- Check if `n` is divisible by `last_digit` without a remainder.
- If the condition is true, increment `count` by 1.

3. After iterating through the range, `count` will contain the number of positive integers less than or equal to 123456 that have a multiple consisting of all the same digits.

Using this process, you can find the answer to the problem.

544