Not just any Fiat

- Nice car you are driving. What is it?
- It is a Fiat 124 Coupe 1975.
- What is special about 124?
- Don’t you know? Plenty of things!
- Mention one.
- 124 can be split in two ways: (1, 24) and (12, 4).
- So can every number with three digits!
- True, but 1 is a factor of 24 and 4 is a factor of 12.
- OK. But many numbers are like that!
- Can you find the biggest? It can have as many digits as you please, but they all have to be distinct.
- What about 123456798?
- Let’s test it. 1 is a factor of 23456798.
- And 12 is a factor of 3456798.
- You are off to a good start.

2 Responses to “Not just any Fiat”

  1. Dave Says:

    If we include zero as one of the digits then the answer is 31806
    If zero is not included then the answer is 981

    These results were found by brute force, using a program to cycle through all possible numbers between 9876543210 and 1 (with logic to skip any number where a digit was repeated in more then once position).

    To keep the code simple, manual edits were required to switch from running a 9 digit number to an 8 digit, and then again to switch to a 7 digit, and so on. Here is a sample of the code from one of the runs…

    Option Explicit

    [code]
    Sub test()
    Dim A As Integer, B As Integer, C As Integer, D As Integer, E As Integer, F As Integer, G As Integer, H As Integer, I As Integer, J As Integer
    Dim iCut As Integer, sNum As String, lDen As Long, lNum As Long, booPass As Boolean
    Dim sngtimer As Single, lCnt As Long

    sngtimer = Timer

    For A = 9 To 1 Step -1
    For B = 9 To 1 Step -1
    If B A Then
    For C = 9 To 1 Step -1
    If C A And C B Then

    DoEvents
    booPass = True
    lCnt = lCnt + 1
    sNum = A & B & C
    For iCut = 1 To Len(sNum) - 1
    If iCut 0 Then
    booPass = False
    Exit For
    End If
    Next

    If booPass Then
    MsgBox sNum
    Exit Sub
    End If

    If (lCnt Mod 10000) = 0 Then
    Debug.Print lCnt & " " & Timer - sngtimer
    End If

    End If
    Next C
    End If
    Next B
    Next A

    End Sub
    [/code]

  2. Richard Sabey Says:

    Let’s try using all 10 digits. Let’s try putting the biggest digit, 9, first. Then the other digits sum to 45, so they make a multiple of 9 in no matter what order the other digits are arranged, so we may split (9, rest).

    Let’s try putting the next biggest digit, 8, second. Then the number formed by the last 7 digits must be a multiple of 98, say 98x. Those digits sum to 37, so it must also leave a remainder of 1 when divided by 9. floor(76543210/98) = 781053, so x is no greater than that; trying successively smaller integers than that finds that, if a=781046, 98a leaves a remainder of 1 when divided by 9. Try successively smaller integers a going down by 9 each time, looking for 98a having all digits 76543210 in some order. This happens first with the 14th, namely x=780929; 98x=76531042, so 9876531042 is therefore your answer: 9 divides 876531042 and 98 divides 76531042.

Leave a Reply

How to use LaTeX in a comment.

You can add images to your comment by clicking here.