Maths Puzzle

Maths and statistics discussion, revision, exam and homework help.

Announcements Posted on
Please change your TSR password 23-05-2013
Enter our travel-writing competition for the chance to win a Nikon 1 J3 camera 20-05-2013
IMPORTANT: You must wait until midnight (morning exams)/4.30AM (afternoon exams) to discuss Edexcel exams and until 1pm/6pm the following day for STEP and IB exams. Please read before posting, including for rules for practical and oral exams. 28-04-2013
Sign in to Reply
  1. RTB's Avatar
    • New Member
    • Posts: 3
    Maths Puzzle
    'Arrange the digits 0 - 9 to form a ten digit number so that the first digit is divisible by 1, the number formed by the first two digits is divisible by 2, the number formed by the first three digits is divisible by 3, and so on up to 10.'

    So far I have:

    ????5????0

    Any ideas?
  2. ttoby's Avatar
    • Vengeful, Imperial Overlord of The Student Room
    • Posts: 3,692
    Here's what I can think of so far:

    Positions 2,4,6,8 must all have even numbers so positions 1,3,7,9 must have odd numbers.

    Positions 4,5,6 must add up to a multiple of three, so since position 5 has digit 5 and the other two positions are even then positions 4,6 can add up to either 4,10,16. The only valid combinations doing that are 2&8 or 4&6.

    Since position 3 is odd, then to make a multiple of 4, position 4 must be 2 or 6. So that leaves us with two possibilities for positions 4,6.
  3. Carolus's Avatar
    • Exalted Member
    • Location: Cambridge
    • Posts: 286
    Re: Maths Puzzle
    I've got that positions 2, 4, 6, 8 are either 4286 or 8642.
  4. aznkid66's Avatar
    • Exalted and Worshipped Member
    • Posts: 922
    Re: Maths Puzzle
    I think ttoby's already going to get it. If you're confused about any of his jumps, here are the divisibility rules:

    Divisibility by 2: Last digit must be 2, 4, 6, 8, or 0.
    Divisibility by 3: Repeated sum of digits must be 3, 6, 9.
    Divisibility by 4: Last two digits must be 00, 04, 08, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96; thus, if the second-to-last digit is odd, the last digit must be 2 or 6.
    Divisibility by 5: Last digit must be 5.
    Divisibility by 6: Last digit must be 2, 4, 6, 8, or 0 and the repeated sum of the digits must be 3, 6, 9.
    Divisibility by 7: No easy one for this problem.
    Divisibility by 8: Last three digits must be 000, 008, 016,...; thus, if the third-to-last digit is even, the last two digits must be 00, 08, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, or 96; thus, if the third-to-last digit is even and the second-to-last digit is odd, the last digit must be 2 or 6.
    Divisibility by 9: Repeated sum must be 9.
    Divisibility by 10: Must end in 0.
    Last edited by aznkid66; 28-06-2012 at 18:59.
  5. ttoby's Avatar
    • Vengeful, Imperial Overlord of The Student Room
    • Posts: 3,692
    Re: Maths Puzzle
    3816547290

    Once you've narrowed down the possibilities for the even numbers, you can then narrow down further using the fact that positions 1,2,3 and 7,8,9 each add up to a multiple of three. Then you just need to try loads of cases to see which ones satisfy the criteria for having a multiple of 7.
  6. miser's Avatar
    • Section Moderator
    • Green Mod
    • Location: Weston-super-Mare
    • Posts: 5,347
    Re: Maths Puzzle
    I thought this was an interesting problem so I wrote a small program to solve it. ttoby is correct, the answer is 3816547290; moreover this is the only correct answer.

    Code:
    using System;
    
    namespace MathsPuzzle
    {
        class Program
        {
            static void Main(string[] args)
            {
                Console.WriteLine("Calculating answer...");
                Console.WriteLine("Answer is: " + Calculate());
    
                Console.WriteLine("Press any key to exit...");
                Console.ReadKey(true);
            }
    
            static long Calculate()
            {
                // Tenth digit must be 0 to be divisible by 10
                // Fifth digit must be 5 to be divisible by 5 as 0 is taken
                // Second, fourth, sixth and eigth digits must be even and take all remaining even digits
                // First, third, seventh and ninth digits must therefore be odd as the even digits are taken
    
                // Arrays of possible values for the unknown digits
                int[] odds = { 1, 3, 7, 9 };
                int[] evens = { 2, 4, 6, 8 };
    
                // Generate array of position combinations to use with odd and even arrays
                int[,] combos = GenerateCombos();
                            
                // Stores each guess
                string guess;
    
                for (int odd = 0; odd < 24; odd++) // C(4, 4) = 24
                {
                    for (int even = 0; even < 24; even++)
                    {
                        // First and second digits
                        guess = odds[combos[odd, 0]].ToString() + evens[combos[even, 0]].ToString();
    
                        // Second and third digits
                        guess += odds[combos[odd, 1]].ToString() + evens[combos[even, 1]].ToString();
    
                        // Fifth digit
                        guess += 5;
    
                        // Sixth and seventh digits
                        guess += evens[combos[even, 2]].ToString() + odds[combos[odd, 2]].ToString();
    
                        // Eigth and ninth digits
                        guess += evens[combos[even, 3]].ToString() + odds[combos[odd, 3]].ToString();
    
                        // 10th digit
                        guess += 0;
    
                        bool validated = true;
    
                        // Validate result
                        for (int k = 3; k <= 9; k++) // Can ignore 1st, 2nd, 10th digits as these will be correct
                        {
                            if (Int32.Parse(guess.Substring(0, k)) % k != 0)
                            {
                                // Validate failed
                                validated = false;
                                break;
                            }
                        }
    
                        if (validated)
                        {
                            // We found a solution
                            return Int64.Parse(guess);
                        }
                    }
                }
    
                return 0; // No solution found
            }
    
            // Populates array with all possible combinations of digits
            static int[,] GenerateCombos()
            {
                int[,] combos = new int[24, 4]; // 24 possible combinations with 4-digit input
    
                // Set the beginning combination
                combos[0, 0] = 0;
                combos[0, 1] = 1;
                combos[0, 2] = 2;
                combos[0, 3] = 3;
    
                // Compute the other combinations
                for (int i = 1; i < 24; i++)
                {
                    if (i % 6 == 0)
                    {
                        if (i % 9 == 0)
                        {
                            // Flip end values
                            combos[i, 0] = combos[i - 1, 3];
                            combos[i, 1] = combos[i - 1, 1];
                            combos[i, 2] = combos[i - 1, 2];
                            combos[i, 3] = combos[i - 1, 0];
                        }
                        else
                        {
                            // Flip left-most values
                            combos[i, 0] = combos[i - 1, 1];
                            combos[i, 1] = combos[i - 1, 0];
                            combos[i, 2] = combos[i - 1, 2];
                            combos[i, 3] = combos[i - 1, 3];
                        }
                    }
                    else if (i % 2 == 1)
                    {
                        // Flip right-most values
                        combos[i, 0] = combos[i - 1, 0];
                        combos[i, 1] = combos[i - 1, 1];
                        combos[i, 2] = combos[i - 1, 3];
                        combos[i, 3] = combos[i - 1, 2];
                    }
                    else
                    {
                        // Flip second right-most values
                        combos[i, 0] = combos[i - 1, 0];
                        combos[i, 1] = combos[i - 1, 2];
                        combos[i, 2] = combos[i - 1, 1];
                        combos[i, 3] = combos[i - 1, 3];
                    }
                }
    
                return combos;
            }
        }
    }
    http://d.pr/i/ezBu
  7. RTB's Avatar
    • New Member
    • Posts: 3
    Re: Maths Puzzle
    (Original post by miser)
    I thought this was an interesting problem so I wrote a small program to solve it. ttoby is correct, the answer is 3816547290; moreover this is the only correct answer.
    Thanks, 3816547290 works ok.

    P.S. Nice code
  8. Alexx53's Avatar
    • Exalted and Worshipped Member
    • Location: London
    • Posts: 964
    Re: Maths Puzzle
    This guy has a video about that, although he uses a nine-digit number using numbers 1-9, but it's the same, just add a 0 on the end

    http://www.youtube.com/watch?v=fSNYW...hannel&list=UL
Sign in to Reply
Share this discussion:  
Article updates
Moderators

We have a brilliant team of more than 60 volunteers looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

Reputation gems:
The Reputation gems seen here indicate how well reputed the user is, red gem indicate negative reputation and green indicates a good rep.
Post rating score:
These scores show if a post has been positively or negatively rated by our members.