Difference between revisions of "2005 PMWC Problems/Problem T10"

(Solution)
(Solutions)
 
(2 intermediate revisions by one other user not shown)
Line 2: Line 2:
 
Find the largest 12-digit number for which every two consecutive digits form a distinct 2-digit prime number.
 
Find the largest 12-digit number for which every two consecutive digits form a distinct 2-digit prime number.
  
== Solution ==
+
== Solutions ==
 +
We list all 2 digit primes:
  
This page needs a solution.  The original one, shown below, has an error (denoted by the bolded statement): the number <math>93</math> is certainly not prime; it is divisible by 3.
+
11, 13, 17, 19
  
''Original Solution:''
+
23, 29
We start with 97, which is the largest 2 digit prime.
 
  
97
+
31, 37
 +
 
 +
41, 43, 47
  
Then we add 9 to get 79, the largest 2 digit prime with tens digit 7.
+
53, 59
  
979
+
61, 67
  
'''Add 3 to get 93, the largest prime less than 97'''
+
71, 73, 79
  
9793
+
83, 89
  
Now the largest two digit prime with tens digit 3 is 37. So we add a 7
+
97
  
97937
 
  
Now we add another 3 as 79 already exists.
+
Note that <math>0,2,4,5,6,8</math> can only appear as the first digit. We can construct the solution by appending digits to the right of the current number with the following maps from the current units digit. <math>1 \to 1,3,7,9; 3 \to 1,7; 7 \to 1,3,9; 9 \to 7</math>. These alone give a maximum of <math>11</math> digits (counting the first digit of the first prime). Note that <math>9</math> may only map one time, but is mapped to from both <math>1</math> and <math>7</math>, so <math>9</math> must also be used as the last digit. To obtain <math>12</math> digits, we must let the first digit must be of the aforementioned alternatives.
  
979373
+
We also note that we need to use both the strings <math>131</math> and <math>737</math>, since the <math>3</math>s may only appear twice. Also, the strings <math>17</math> and <math>97</math> must appear, barring <math>7</math> from being the second digit. These together imply that <math>3,7,9</math> cannot be the first digit, so the second digit must be <math>1</math>. We [[Greedy algorithm|greedily]] use <math>61</math> first.
  
And proceeding like this will get us
+
At each step, we pick the maximal number that does not yield a contradiction. This immediately gives:
  
979373191713
+
<cmath>\boxed{619737131179}</cmath>
  
 
== See also ==
 
== See also ==

Latest revision as of 15:30, 3 July 2012

Problem

Find the largest 12-digit number for which every two consecutive digits form a distinct 2-digit prime number.

Solutions

We list all 2 digit primes:

11, 13, 17, 19

23, 29

31, 37

41, 43, 47

53, 59

61, 67

71, 73, 79

83, 89

97


Note that $0,2,4,5,6,8$ can only appear as the first digit. We can construct the solution by appending digits to the right of the current number with the following maps from the current units digit. $1 \to 1,3,7,9; 3 \to 1,7; 7 \to 1,3,9; 9 \to 7$. These alone give a maximum of $11$ digits (counting the first digit of the first prime). Note that $9$ may only map one time, but is mapped to from both $1$ and $7$, so $9$ must also be used as the last digit. To obtain $12$ digits, we must let the first digit must be of the aforementioned alternatives.

We also note that we need to use both the strings $131$ and $737$, since the $3$s may only appear twice. Also, the strings $17$ and $97$ must appear, barring $7$ from being the second digit. These together imply that $3,7,9$ cannot be the first digit, so the second digit must be $1$. We greedily use $61$ first.

At each step, we pick the maximal number that does not yield a contradiction. This immediately gives:

\[\boxed{619737131179}\]

See also

2005 PMWC (Problems)
Preceded by
Problem T9
Followed by
Last Question
I: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
T: 1 2 3 4 5 6 7 8 9 10