29

A Monday number is a positive integer $N$ with the following three properties:

  • The decimal representation of $N$ does not contain the digit 0
  • The decimal representation of $N$ does not contain any digit twice
  • $N$ is divisible by every digit $D$ that occurs in its decimal representation

What is the largest Monday number?

Gamow
  • 45,573
  • 10
  • 147
  • 381
  • 1
    Can you clarify rule 2 please? Should it state that N contains no more that one of any digit (otherwise digits can appear 3 or more times)? – Gordon K Sep 28 '15 at 08:36
  • 1
    Why Monday? You named it yourself, or is there such a mathematical concept? – ghosts_in_the_code Sep 28 '15 at 09:03
  • 3
    My guess is that it is because today is Monday and perhaps he will give us a puzzle every day so tomorrow a puzzle with a Tuesday number might be asked – Ivo Sep 28 '15 at 09:07
  • @GordonK - I think that's a given, because if a digit is allowed more than twice, there would pretty much be no limit, making it impossible to define a "largest" number with these properties. 987654321 would therefore be the largest potential candidate by rules 1 and 2. (Though it fails rule 3.) – Darrel Hoffman Sep 28 '15 at 14:18
  • Because of rule 3, rule 1 doesn't make sense. Of course you can't have 0 if you have to be able to divide by each digit! – corsiKa Sep 28 '15 at 14:47
  • 3
    @corsiKa I would say rule 1 is redundant, not that it doesn't make sense – Kevin Sep 28 '15 at 18:24
  • 2
    Perhaps I should rephrase "The existence of rule 1 doesn't make sense" – corsiKa Sep 28 '15 at 18:28
  • 1
    I can see people questioning, "what about zero?!" if the first rule wasn't there. Because divide by zero is undefined, they might think its somehow exempt from rule #3. – JPhi1618 Sep 28 '15 at 19:18
  • @JPhi1618 I assumed that that was precisely why it was mentioned specifically. – ghosts_in_the_code Sep 29 '15 at 10:17
  • Related: https://codegolf.stackexchange.com/q/59014 – msh210 May 11 '18 at 08:56

1 Answers1

46

Notice 9867312 is a Monday number.

The largest Monday number may not contain 5 because in this case it would end in 5, and thus not be divisible by 2, 4 and 8, so it would have at most 6 digits.

On the other hand, a Monday number may not have 8 digits. Indeed, if that were the case, the preceding paragrph would imply such a number has each digit but 0 and 5 in it. In particular, it would have the digit 3. But the sum of its digits would be 1 + 2 + 3 + 4 + 6 + 7 + 8 + 9 = 40, which is not divisible by 3.

It follows that the largest Monday number must have 7 digits. If it has the digits 9, 8 and 7 it must be a multiple of 504, and it's easy check the highest Monday number that is a multiple of 504 is 9867312. Because we know the largest Monday number has 7 digits, it follows that this is the largest such number.

Fimpellizzeri
  • 2,567
  • 1
  • 13
  • 21
  • 7
    As addition to the answer: We can know that if there is a 7 digit answer that the removed digit must be the digit 4. Because the sum of 98764321 = 40 and the sum of the digits must be divisible by 9 to be divisible by 9 and 4 is the only single digit number that can be removed from 40 to make a number divisible by 9, – Ivo Sep 28 '15 at 09:00
  • 3
    That is correct, for 7 digit answers with the number 9 in them. – Fimpellizzeri Sep 28 '15 at 09:05
  • 1
    @Fimpellizieri: and potential seven-digit answers without the number 9 in them are smaller than 9867312 :-) But anyway 9 and 5 can't be the missing digits because of divisibility by 3. – Steve Jessop Sep 28 '15 at 12:22
  • @SteveJessop: You meant 9 and 6, right? – Darrel Hoffman Sep 28 '15 at 16:21
  • @DarrelHoffman: no, I meant that the 7-digit number in question cannot consist of the digits 1,2,3,4,6,7,8, that is to say the two missing digits cannot be "9 and 5". It's also true that the missing digits can't be "9 and 6", (since we already know that 5 has to be missing), and that they can't be "6 and 5" (because of divisibility by 3), I just wasn't saying that :-) – Steve Jessop Sep 28 '15 at 16:27
  • 1
    "If it has the digits 9, 8 and 7 it must be a multiple of 504, and it's easy check the highest Monday number that is a multiple of 504 is 9867312." (And if it doesn't have all of the digits 9, 8 and 7, then it can be at most 9864321, which is less than 9867312.) Nice job! – mathmandan Sep 28 '15 at 16:44
  • @KritixiLithos It is divisible by 9. $9867312 = 9 \times 1096368$. – Fimpellizzeri Sep 29 '15 at 18:47