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

Home > Numbers
Circular Prime Puzzle (Posted on 2024-11-05) Difficulty: 3 of 5
A circular prime is one in which all cyclic permutations of its digits are prime. For example, 1193 is a circular prime because 1931, 9311, and 3119 are prime.

Find the largest circular prime less than 1,000,000.

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution Comment 2 of 2 |
p=1000000; found=false;
while ~found
  p=prevprime(p-1);
  ps=num2str(p);
  found=true;
  pset=p;
  for i=1:5
    ps=[ps(2:end),ps(1)];
    if ~isprime(str2double(ps))
      found=false;
      break
    else
      pset(end+1)=str2double(ps);
    end
  end
end
pset

finds the largest such is the first number listed below in the cycle:

999331  993319  933199  331999  319993  199933

  Posted by Charlie on 2024-11-05 11:51:45
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 (4)
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