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

Home > Just Math
An unlikely solution! (Posted on 2024-02-21) Difficulty: 3 of 5
The values p and q in the quadratic expression 2x2 - px + q are determined by throwing two standard fair cubical dice, one red and one blue.

p is given by the value shown by the red die and q is given by the value shown on the blue die.

What is the probability that the equation 2x2 - px + q = 0 will have a solution that is a prime number?

No Solution Yet Submitted by Danish Ahmed Khan    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
No Subject Comment 4 of 4 |

hits=0;
for p=1:6
  for q=1:6
    disc=p^2-4*2*q;
    if disc>=0
      hit=false;
      s1=(p+sqrt(disc))/4;
      if s1>0 && s1==round(s1)
        if isprime(s1)
          hit=true;
        end
      end
      s2=(p-sqrt(disc))/4;
      if s2>0  && s2==round(s2)
        if isprime(s2)
          hit=true;
        end
      end
      if hit
        hits=hits+1;
        fprintf('%d %d %d %5f\n',p,q,s1,s2)
      end
    end
  end
end
hits/36

         solutions 

p q 1     2

5 2 2 0.500000

6 4 2 1.000000

only two have prime solutions

ans =


    0.0556


  Posted by Charlie on 2024-02-21 23:06:05
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 (9)
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