Prime permutations

Are there any three distinct digits a , b , c a, b, c such that all six permutations a b c , a c b , b a c , b c a , c a b , c b a \overline{abc}, \overline{acb}, \overline{bac}, \overline{bca}, \overline{cab}, \overline{cba} are prime numbers?

Yes No

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

7 solutions

Since any 3-digit numbers ending in an even digit or 5 5 are not prime, we limit ourselves to the digits 1, 3, 7, 9. We can make four subsets: { 1 , 3 , 7 } , { 1 , 3 , 9 } , { 1 , 7 , 9 } , { 3 , 7 , 9 } . \{1,3,7\}, \{1,3,9\}, \{1,7,9\}, \{3,7,9\}. We must check divisibility by primes up to 31.

For divisibility by 3, consider the sum of digits. For the four sets of digits, they are 11, 13, 17, 19, none of which are multiples of three.

For divisibility by 7, consider that x y z \overline{xyz} is a multiple of 7 iff 2 x + 3 y + z 2x + 3y + z is. This simplifies even more if one of the digits is 7.

  • Since 2 3 + 1 = 7 2\cdot 3 + 1 = 7 , 371 371 is a multiple of 7. This rules out the first set.

  • Since 2 9 + 3 1 = 21 2\cdot 9 + 3\cdot 1 = 21 is a mutiple of 7, so is 917 917 . This rules out the third set.

  • Since 2 9 + 3 = 21 2\cdot 9 + 3 = 21 is a multiple of 7, so is 973 973 . This rules out the fourth set.

The second set also has a multiple of 7 (931) but this may be harder to see. Note, however that 9 1 + 3 = 11 9 - 1 + 3 = 11 , so that 913 913 is a multiple of 11. Either way, we have excluded the second set.

Therefore there are no sets of three digits that satisfy the requirements.


Extensions: What if we work with four distinct digits? What if we allow two or more of the digits to be equal?

An interesting explanation.

Nice to see how you check for primes without gadgetry!

Robert Williams - 3 years, 5 months ago

Observing that one of the numbers is divisible by 7 is interesting. Perhaps there is a better way to present that argument?

E.g. one simplification is that we want to show 0 a + 1 b + 2 c + 3 d 0 ( m o d 7 ) 0a + 1b + 2c + 3d \equiv 0 \pmod{7} has a solution with { a , b , c , d } = { 1 , 3 , 7 , 9 } \{ a, b, c, d \} = \{ 1, 3, 7, 9 \} for all values of a = 1 , 3 , 7 , 9 a = 1, 3, 7, 9 .

Calvin Lin Staff - 3 years, 5 months ago

Why do we have to check for dividibility up to 31?

Arianna Colella - 3 years, 5 months ago

Log in to reply

The largest number we can make is 973 973 , which lies between 3 1 2 31^2 and 3 2 2 32^2 .

Arjen Vreugdenhil - 3 years, 5 months ago

That’s how I did with this problem. But instead of enumeration method do you have any other more elegant solutions?

Yinchen Wu - 3 years, 5 months ago

Log in to reply

Limiting the 120 possible sets of three distinct digits to 4 is already pretty elegant :)

Arjen Vreugdenhil - 3 years, 5 months ago

What about if the distinct digits were 0, 1, and 3, for example? Then, both 13 and 31 are prime, and make up all six permutations.

F Plummer - 3 years, 5 months ago

Log in to reply

If you use the digit 0, along with 1 and 3, your list of numbers in increasing order must be 13, 31, 103, 130, 301, 310.

Clearly some of these are not prime.

Brian Dearing - 3 years, 5 months ago

Log in to reply

We commonly assume that numbers do not start in zero.

Arjen Vreugdenhil - 3 years, 5 months ago

Log in to reply

@Arjen Vreugdenhil Also neither 0 nor 1 are considered prime in any case - 2 is considered to be the first prime number.

Thomas Sutcliffe - 3 years, 5 months ago

Log in to reply

@Thomas Sutcliffe But neither 0 nor 1 is a number you can make from 3 distinct digits, so neither can be a number we need to check for primality.

Stewart Gordon - 3 years, 5 months ago

Good solution.

Following up on your mod 7 work, I think you can also say: if none of the six permutations are multiples of 7, and neither are a or b, but c is, then a ± b m o d 7 a \equiv \pm b \mod 7 .

Peter Byers - 3 years, 5 months ago

Log in to reply

Not quite. It appears that you overlooked a multiplication by 10.

If c 0 c \equiv 0 mod 7, then a b 0 \overline{ab0} is a multiple of 7 iff a b 0 \overline{ab} \equiv 0 mod 7, i.e. 3 a b 3a \equiv -b mod 7.

(Example: 347 is not a multiple of 7, even though 3 4 3 \equiv -4 mod 7. But 3 3 2 ≢ 4 3\cdot 3 \equiv 2 \not\equiv -4 mod 7.)

(Other example: 357 is a multiple of 7, even though 3 ≢ 5 3 \not \equiv -5 mod 7. But 3 3 2 5 3\cdot 3 \equiv 2 \equiv -5 mod 7.)

Arjen Vreugdenhil - 3 years, 5 months ago

Log in to reply

What about the qualifier, "If none of the six permutations are multiples of 7?"

Forest Yang - 3 years, 5 months ago

I noticed some interesting properties of multiples of 7 in this problem. Does anyone know a mathematical proof that could be used instead of checking through trial and error? Every set had one multiple of 7.

Emily Gray - 3 years, 5 months ago

I also solved by trial and error - if repeated dgits are allowed then 337 works, since 373 and 733 are both also prime.

Thomas Sutcliffe - 3 years, 5 months ago

Extensions have been suggested: What if we work with four distinct digits? What if we allow two or more of the digits to be equal? Might I suggest another one: what if all the numbers are expressed to some base other than 10?

Robert Gordon Newcombe - 3 years, 5 months ago

I came across this easier method to check divisibility by 7 Remove the last digit, double it, subtract it from the truncated original number and continue doing this until only one digit remains. If this is 0 or 7, then the original number is divisible by 7. Example: 371->37-1(2)=35 which us div by 7, thus no is div by 7

Mohit kamra - 3 years, 5 months ago

Do you have PhD in maths?

Anshika Singh - 3 years, 5 months ago

Log in to reply

No, I have an M.Sc.

Arjen Vreugdenhil - 3 years, 5 months ago

I definitely misread the original problem and did the extension instead. I also quickly narrowed it down to 1, 3, 7, and 9 as digits to work with, and saw quickly that 1, 3, and 9 wasn't going to work , nor would all 1's (111 is divisble by 3), or all of any but I figured that 113 would, and since there are two 1's the number of unique numbers was limited, after checking 131 and 311 I said the answer was yes, then upon getting the wrong answer I reread the question and saw my mistake.

Good question though.

David Forester - 3 years, 4 months ago

Why does it say only check prime numbers till 31

Mudit T - 2 years, 3 months ago
Piero Sarti
Dec 26, 2017

I have to be honest my solution is kind of ugly and involves some rigorous work but here it is anyways.

First off let's start by eliminating possibilities of digits. Obviously a , b a, b or c c cannot be even, nor can any of them be the digit 5 5 . This leaves us with the possible digits 1 , 3 , 7 1,3,7 and 9 9 .

How many ways are there of choosing 3 digits/items in a list of 4? 4 C 3 4C3 or 4 ways. The possible picks are ( 1 , 3 , 7 ) , ( 1 , 7 , 9 ) , ( 1 , 3 , 9 ) (1, 3, 7), (1, 7, 9), (1, 3, 9) or ( 3 , 7 , 9 ) (3, 7, 9) .

The only thing left to show is that at least one of the permutations of these three picks are not prime.

So I used a prime number database and found that for ( 1 , 3 , 7 ) (1, 3, 7) , 731 731 was not prime. For ( 1 , 7 , 9 ) (1, 7, 9) , 791 791 was not prime. For ( 1 , 3 , 9 ) (1, 3, 9) , 931 931 was not prime and finally for ( 3 , 7 , 9 ) (3, 7, 9) , 793 793 was not prime.

This means that no there do not exist any 3 distinct digits a , b , c a, b, c such that all 6 permutations a b c , a c b , b a c , b c a , c a b \overline{abc}, \overline{acb}, \overline{bac}, \overline{bca}, \overline{cab} and c b a \overline{cba} are all prime.

The reason I say it's not a nice solution is because in the worst case scenario you would have to end up checking if 24 numbers are prime or not prime.

Solved it the same way. I thought only I could have such an ugly solution. Thank you

Andrew Lysenko - 3 years, 5 months ago
Angel Krastev
Dec 28, 2017

No. From the list of all 3-digit prime numbers we eliminate all with repeating digits, all containing the even digits 02468, and all containing 5. We end up with 13 eligible primes made from 1379. Direct check gives us these lines:

137,173,317;

179,197,719,971;

139,193;

379,397,739,937.

None of these lines has 6 primes.

? 113,131,311 ?

Robert Mcbrayer - 3 years, 5 months ago

Log in to reply

Distinct digits, i.e. each digit is only allowed to be used once.

Naeem Chaudhry - 3 years, 5 months ago

Are there any three DISTINCT digits... So, No repeating digits.

Angel Krastev - 3 years, 5 months ago
John Williamson
Dec 29, 2017

DIVISIBILITY BY 2?

  • Any 3-digit integer ending in 0, 2, 4, 6, or 8 is divisible by 2, so ...
  • ... we eliminate all even digits from consideration.

DIVISIBILITY BY 5?

  • Any 3-digit integer ending in 5 is divisible by 5, so ...
  • ... we eliminated from consideration.

REVISED QUESTION:

  • Are there any three distinct digits out of the set {1, 3, 7, 9} such that all six permutations are prime numbers?

DIVISIBILITY BY 3?

  • The sum of the four remaining digits (1+3+7+9) is equal to 20
  • The only possible sums of three of these digits are 20-1, 20-3, 20-7 and 20-9.
  • None of these, 19, 17, 13 or 11, are divisible by 3
  • None of the 3 digits that can be made from 1, 3, 7 and 9 are divisible by 3.

FOUR SUBSETS TO CONSIDER!

  • {1, 3, 7}
  • {1, 3, 9}
  • {1, 7, 9}
  • {3, 7, 9}

DIVISIBLE BY 7?

A (relatively) simple check for divisibility of the number XYZ is to test the divisibility of XY - 2Z.

  • XYZ is divisible by 7 if and only if XY - 2Z is also divisible by 7

Let's scan each subset to see if we can find one permutation that is divisible by this trick:

  • 317? → 37 - 2 · 1 = 37 - 2 = 35 → 35 is divisible by 7 so 371 is divisible by 7
  • 931? → 93 - 2 · 1 = 93 - 2 = 91 → 9 - 2 · 1 = 7 → 91 is divisible by 7, so 931 is divisible by 7
  • 791? → 79 - 2 · 1 = 79 - 2 = 77 → 77 is divisible by 7 so 791 is divisible by 7
  • 973? → 97 - 2 · 3 = 97 - 6 = 91 → 9 - 2 · 1 = 7 → 91 is divisible by 7, so 973 is divisible by 7

CONCLUSION

  • We have eliminated every combination of three digits out of the set {1, 3, 7, 9}.
  • There is no set of three digits in which every permutation is prime because ...
  • ... every possible set of three digits includes at least one possible composite permutation.

ONE MORE TRICK? DIVISIBLE BY ELEVEN?

  • A trick we can use with XYZ is to add the first and third digits and subtract the middle digit:
  • XYZ is divisible by 11 if and only if X+Z-Y is divisible by 11

  • 913? 9+3-1 = 11 → 11 is divisible by 11, so 913 is divisible by 11.

But we didn't need this final test, as we already proved it above. I just included it here because it's a neat little trick.

You can use Algebra to prove why these tricks work.

Zach Bian
Dec 28, 2017

I dunno. Let's find out:

1
curl -s "http://primes.utm.edu/lists/small/1000.txt" | tail -n +5 | tr " " "\n" | perl -pe "s/^(\d\d)$/0\1/" | grep -Ph "^(1[^1]{2}|3[^3]{2}|7[^7]{2}|9[^9]{2})$" | grep -Ph "^\d1[^1]|\d3[^3]|\d7[^7]|\d9[^9]$" > tmp.txt; ots=`cat tmp.txt | grep -P "[137]{3}" | wc -l`; otn=`cat tmp.txt | grep -P "[139]{3}" | wc -l`; osn=`cat tmp.txt | grep -P "[179]{3}" | wc -l`; tsn=`cat tmp.txt | grep -P "[379]{3}" | wc -l`; if [[ `echo $ots$otn$osn$tsn | grep "6"` -eq 0 ]] then echo "Nope."; else echo "Yup."; fi; rm tmp.txt

Or more readably:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#!/bin/bash
# First grab source file and sanitize it a bit.
# We can safely ignore 0,2,4,5,8
curl -s "http://primes.utm.edu/lists/small/1000.txt" | tail -n +5 | tr " " "\n" | perl -pe "s/^(\d\d)$/0\1/" | grep -Ph "^(1[^1]{2}|3[^3]{2}|7[^7]{2}|9[^9]{2})$" | grep -Ph "^\d1[^1]|\d3[^3]|\d7[^7]|\d9[^9]$" > tmp.txt
# Search for all permutations:
ots=`cat tmp.txt | grep -P "[137]{3}" | wc -l`
otn=`cat tmp.txt | grep -P "[139]{3}" | wc -l`
osn=`cat tmp.txt | grep -P "[179]{3}" | wc -l`
tsn=`cat tmp.txt | grep -P "[379]{3}" | wc -l`
# Concatenate and search, since matches are at most 6, we are guaranteed 1 digit each
if [[ `echo $ots$otn$osn$tsn | grep "6"` -eq 0 ]] then
    echo "Nope."
else
    echo "Yup."
fi
rm tmp.txt

Which gives us:

1
Nope.

Giorgos K.
Jan 2, 2018

Mathematica

Select[Subsets[Range[0, 9], {3}],And@@PrimeQ[FromDigits/@Permutations@#]&] yields NO

Steve Zagieboylo
Dec 29, 2017

I disagree. The problem never said that these numbers with three digits were in base 10. I feel pretty confidant that if we choose the right base, we'll be able to find a combination that works.

If you are going to think along those lines: all numbers you ever work with are in base 10.

Even binary numbers and hexadecimal numbers are in base 10.

Arjen Vreugdenhil - 3 years, 5 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...