7 dwarfs have written all natural numbers less than 1,000,000, in order. After that they highlight a number if the sum of its digits is divisible by 7. Can they have two consecutive numbers highlighted?

Submit "0" as your answer if there is no pair of consecutive numbers highlighted and the smaller number in the first pair they will highlight otherwise.

incognitouser60 Jan 20, 2024

#1**+1 **

For the all the units digits under 9, it just won't work. Even if the first digit is divisible by 7, adding one to the units digits will only change it by 1 value, which doesn't make it divisable by seven. If you know modular arithmetic, the first number would be 0 mod 7, and the second 1 mod 7. For the value 9, it gets slightly more tricky. However, if you try a number like 759, adding 1 will give you 760, or -1 mod 7. Adding another 9, like 5599 (it there must be an even amount of 5 and 9s - can you see why?) pulled up to 5600 will give you 11. 555999 gives you 556000, or 16 (doesn't work!). The next one (55559999) is much too big. From now, we can consider numbers that end with 0. For the number 770 (769), it doesn't work. Same for for 7770, 77770, 777770, etc. 700 doesn't work, and 7000 doesn't. But 70000 works! 70000 and 69999 works! Sadly, afterwards no other number works. So your answer is one. (BTW, I'm not very sure if this is correct, because I somewhat brute forced this.)

Also, just a bonus thing I learned, the sum of the digits (if it has a nine - otherwise it doesn't work) has to be divsible by 21 (7*3) - idk who asked though

moneydude242 Jan 20, 2024