Is there a systematic way to determine the number of numbers between 10 and, say, 50, divisible by their units digits?

I saw a variation on this recently... somewhere. Not allowed to say where. But I ended up writing out some numbers and finding a pattern.

For example...

  • anything divisible by 11 is divisible by the units digit, so that includes 11, 22, 33, and 44.
  • anything that is a multiple of 12 counts, so 12, 24, 36, and 48, but of course not 60.
  • anything ending in 1 counts, so 21, 31, and 41
  • anything ending in 2 counts, so 32 and 42.
  • only 33 ends in 3 and is also divisible by 3, so that doesn't count.
  • numbers ending in 4 count if I didn't say them, nothing really.
  • anything ending in 5 counts, so 15, 25, 35, and 45.
  • the only number that counts that ends in 6 is 36, but I already said it.
  • nothing ending in 7 counts until 77, which is larger than 50.
  • nothing ending in 8 counts since I already said 48.
  • nothing ending in 9 counts until 99, which is larger than 50.
  • and nothing ending in 0 counts.

And I think that's all of them, so 17 numbers. Which is so abnormal, really.

1 Answer
Mar 18, 2016

The number of numbers between #10# and #10k# divisible by their units digit can be represented as

#sum_(n=1)^9 fl((k*gcd(n,10))/n)#

where #fl(x)# represents the floor function, mapping #x# to the greatest integer less than or equal to #x#.

Explanation:

This is equivalent to asking how many integers #a# and #b# exist where #1<=b<5# and #1<=a<=9# and #a# divides #10b+a#

Note that #a# divides #10b + a# if and only if #a# divides #10b#. Thus, it suffices to find how many such #b#s exist for each #a#. Also, note that #a# divides #10b# if and only if each prime factor of #a# also is a prime factor of #10b# with appropriate multiplicity.

All that remains, then, is to go through each #a#.

#a = 1#: As all integers are divisible by #1#, all four values for #b# work.

#a=2#: As #10# is divisible by #2#, all four values for #b# work.

#a=3#: As #10# is not divisible by #3#, we must have #b# being divisible by #3#, that is, #b=3#.

#a=4#: As #10# is divisible by #2#, we must have #b# as divisible by #2# to have the appropriate multiplicity. Thus, #b=2# or #b=4#.

#a=5#: As #10# is divisible by #5#, all four values for #b# work.

#a=6#: As #10# is divisible by #2#, we must have #b# as divisible by #3#, that is, #b=3#.

#a=7#: As #10# is not divisible by #7#, we must have #b# as divisible by #7#. But #b<5#, and so no value for #b# works.

#a=8#: As #10# is divisible by #2#, we must have #b# as divisible by #4#, that is, #b=4#

#a=9:# As #10# is not divisible by #3#, we must have #b# as divisible by #3^2#. But #b<5#, and so no value for #b# works.

This concludes each case, and so, adding them up, we get, as concluded in the question, #17# values. This method can easily be extended to greater values, however. For example, if we wanted to go from #10# to #1000#, we would restrict #1<=b<100#. Then, looking at #a=6#, say, we would have #2# divides #10# and thus #6# divides #10b# if and only if #3# divides #b#. There are #33# multiples of #3# in the range for #b#, and thus #33# numbers which end in #6# and are divisible by #6# between #10# and #1000#.

In a shorter, easier to calculate notation, using the observations above, we can write the number of integers between #10# and #10k# as

#sum_(n=1)^9 fl(k/(n/gcd(n,10)))=sum_(n=1)^9 fl((k*gcd(n,10))/n)#

where #fl(x)# represents the floor function, mapping #x# to the greatest integer less than or equal to #x#.