Maths Puzzle
Maths and statistics discussion, revision, exam and homework help.
-
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. -
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. -
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. -
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.
http://d.pr/i/ezBuCode: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; } } } -
Re: Maths PuzzleThanks, 3816547290 works ok.(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.
P.S. Nice code -
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
