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

Home > Numbers
A Prime Time #2 (Posted on 2024-07-12) Difficulty: 3 of 5
A 11-digit number is such that it contains each of the digits from 1 to 9 at least once.

What is the percentage of prime numbers in such an occurrence?

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Some Thoughts Monte Carlo method Comment 2 of 2 |
The program does one million trials. Each trial starts with a random permutation of the digits 1 through 9. Then digits randomly chosen from 0 through 9 are placed randomly relative to the existing digits until an 11-digit number is formed (it will not place a zero before the first digit, so it might need more than two tries to achieve 11 digits).

primeCt=0;
for trial=1:1000000
  p=randperm(9);
  while length(p)<11
    d= randi(10)-1 ;
    psn=randi(length(p)+1);
    if d>0 || psn>1
      p=[p(1:psn-1) d p(psn:end)];
    end
  end
  p=str2double(erase(num2str(p),' '));
  if isprime(p)
    primeCt=primeCt+1;
  end
end
primeCt/trial

It found   43878 primes in the million trials for a probability of  0.043878, or 4.4%.

  Posted by Charlie on 2024-07-13 09:20:13
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (1)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (6)
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