21
$\begingroup$

What is the largest prime with distinct digits? (It is certainly less than ten digits long.Can you explain it why?

$\endgroup$
3
  • $\begingroup$ How many digits are there total? How many of them can I pick before I must get a repeat? $\endgroup$
    – Slade
    Oct 25 '14 at 13:44
  • 3
    $\begingroup$ The answer to this question in various bases is given in oeis.org/A132129. $\endgroup$ Oct 26 '14 at 5:53
  • $\begingroup$ @EricM.Schmidt That link spoils my answer! Suggestion to other readers: try working some out for yourself before clicking on the link. The list goes up to base 10 with values up to base 16 in the comments. Also, try working out the base n representation of each number as the primes in the list are all given in base 10. $\endgroup$
    – CJ Dennis
    Oct 26 '14 at 6:58
65
$\begingroup$

The answer should be $$p=987654103.$$ As any number using all ten digits would by a multiple of $3$, we are left with only few nine-digit candidates $987654xyz$ that can be checked manually.

$\endgroup$
7
  • $\begingroup$ How do you know it has to be of the form $987654xyz$? $\endgroup$ Oct 26 '14 at 19:35
  • 3
    $\begingroup$ Around the 987654000 mark, about one in $ln(10^9) \approx 20$ numbers is prime according to the Prime Number Theorem. So it's a fair guess that the 24 eligible numbers of those form contain a prime. If (by chance) that didn't happen, the next step be would to check numbers of the form $987653xyz$. $\endgroup$
    – yatima2975
    Oct 26 '14 at 19:47
  • 3
    $\begingroup$ @yatima2975 I didn't formulat eit clear enough, but I did test all permutations and this is the largest prime. Note that $\{x,y,z\}$ must be $\{0,1,3\}$ or $\{0,2,3\}$ to avoid divisibility by $3$, and the last digit must be odd. Hence only $\ldots301$ and $\ldots 203$ need to be tested really (and they are composite). - So with the $p$ as in my answer given, the proof that it is correct requires only three primality tests. $\endgroup$ Oct 26 '14 at 21:27
  • 1
    $\begingroup$ The largest number with 10 unique digits is 9876543210, but it's even so divisible by 2 and not a prime. The next few to try might be 9876543201 or 9876543021 or perhaps 9876542301. But, as you say, those are divisible by 3 and so, not primes. It's surprising (and totally not obvious to me) to hear that "any number using all ten digits would by a multiple of 3"... Why is that so? Maybe this should be asked as a seperate question on its own, but you state it so matter-of-factly here in your answer, perhaps you could explain that a bit. $\endgroup$ Oct 26 '14 at 23:20
  • 6
    $\begingroup$ @KevinFegan if the sum of the digits of a number is divisible by 3, the number is divisible by three. $\endgroup$
    – David
    Oct 26 '14 at 23:27
15
$\begingroup$

Hint: Suppose you had all ten digits - what would the sum of the digits be?

$\endgroup$
10
$\begingroup$

This question depends on the number base being used. It is assumed that the OP meant base 10, but there is nothing special about that (or the answer) except that humans generally have ten fingers. Here are a few others in different bases:

  • base 2: 10 (2)
  • base 3: 201 (19)
  • base 4: 103 (19, using all three non-zero digits always results in a number divisible by 3)
  • base 5: 4302 (577, using all four non-zero digits always results in a number divisible by 2)

Higher bases are left as an excerise for the reader!

$\endgroup$
4
  • 10
    $\begingroup$ If we allow this approach, then I suppose there is no "largest prime with distinct digits", because any prime p can be represented as just a single digit in base p + 1 . . . $\endgroup$
    – ruakh
    Oct 26 '14 at 3:28
  • 1
    $\begingroup$ base 48112959837082048696: 10 ;P $\endgroup$
    – tox123
    Oct 26 '14 at 22:36
  • 3
    $\begingroup$ @x-x Nice try but it's not the largest! It's not even prime! $\endgroup$
    – CJ Dennis
    Oct 27 '14 at 1:28
  • 1
    $\begingroup$ @numberknot Some interesting insights can be had by playing with this idea, and it can really pull you out of the mode of thinking about numbers as series of glyphs. $\endgroup$
    – zxq9
    Oct 27 '14 at 3:41
1
$\begingroup$

If all the digits are used, it will be divisible by 3, right? Same also if you will use the digits 1-9. Therefore, the largest prime number with different digits is less than 10 digits. If it would be nine digits, O is included as one of the digits.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.