All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Prime with distinct digits (Posted on 2013-09-18) Difficulty: 3 of 5
What is the biggest prime number, no digits repeated if

a. zero can be included?
b. zero is excluded?

See The Solution Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 2

A 10-digit number with all the different decimal digits will be divisible by 3 as the sum of the digits would be 45, which is divisible by 3. A non-zero digit must be eliminated, so a prime with 9 digits will need to have a zero.

  5   P=98700000
 10   while P<99000000
 30   P=fnNxprime(P)
 40   Ps=cutspc(str(P))
 50   Good=1
 60   for I=1 to len(Ps)-1
 70     if instr(mid(Ps,I+1,*),mid(Ps,I,1))>0 then Good=0:cancel for:goto 100
 80   next
 90   if Good then print P
100   wend
999   end


The last few 9-digit cases are:

987651403
987652301
987653201
987654103

so 987654103 is the highest when zero is included.

The last few 8-digit cases are:

98764321
98765143
98765201
98765413
98765431

which includes the highest without a zero: 98765431.


  Posted by Charlie on 2013-09-18 17:33:46
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (0)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information