Let's recall a few facts. A Harshad or Niven number is a number that is divisible by its sum of digits. For example, 21 has a sum of digits of 3 and 3 divides 21 to give 7. Thus 21 is a Niven number, at least in base 10. What about in other bases? Well, in base 7, 21 can be represented as 30 with a sum of digits of 3 again. So 21 is a Niven number in base 7 as well. What about in base 2 where it has a representation of 10101. Again the sum of digits is 3 and thus 21 is also a Niven number in base 2. Of course, 21 is not a Niven number in all bases. In base 8, the number is represented as 25 with a sum of 7 which does not divide into it.
![]() |
Source |
Now I've written about Gray Code in an eponymous post on 18th June 2023 so I won't go into the topic again here. Suffice to say that to generate the Gray Code of a number we convert it to binary and make certain changes to the binary digits. Let's illustrate this by way of the number associated with my diurnal age today, 27727. It's binary representation is 110110001001111 and the Gray Code equivalent is 101101001101000. Now how many 1's are there in the latter. There are seven which corresponds of course to its digit sum. Now 7 divides 27727 because its factorisation is 7 x 17 x 233. So 27727 with its digit sum of 25 is not a Niven number in base 10. Nor is it a Niven number in base 2 where there are nine 1's. However, it is a Gray Code Niven number!
These sorts of numbers caught my attention because of OEIS A344344:
Figure 1 shows the results for the four consecutive numbers (permalink):
![]() |
Figure 1 |
No comments:
Post a Comment