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

Home > Numbers
All digits distinct (Posted on 2018-12-12) Difficulty: 2 of 5
What is the highest prime number with no repeated digits?

See The Solution Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
re: late computer solution | Comment 4 of 5 |
(In reply to late computer solution by Larry)

I've been looking for puzzles to practice MATLAB programming and your post caught my interest. MATLAB certainly is progress over what I did a couple of years ago. Thanks for calling my attention to this old puzzle.


n='0123456789';
p=perms(n);
ct=0;
for i=1:size(p,1)
   
    if isprime(str2num(extractBefore(p(i,:),10)))
        disp(extractBefore(p(i,:),10))
        ct=ct+1;
        if ct>=50 
            break
        end
    end
  
end

This found the highest 50 in under a second. Of course the MATLAB engine did most of the work. But I'm learning things like extractBefore. I had already discovered that the permutations it finds are in reverse order from what they "should" be, given how they are entered.

987654103
987653201
987652301
987651403
987651043
987650413
987650341
987650231
987645103
987645013
987643021
987641203
987640351
987640321
987640123
987632501
987630421
987630251
987625403
987625031
987621053
987620531
987615403
987615203
987612053
987610423
987605413
987605341
987604523
987603521
987603241
987602531
987602513
987601543
987601243
987563021
987562403
987560143
987546103
987542063
987540613
987536201
987530261
987526403
987526103
987526013
987516403
987506341
987506213
987503641

  Posted by Charlie on 2020-12-12 16:11:41
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 (24)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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