How do you determine the values of m and k in a strong primality test?

  • Thread starter Thread starter JaeSun
  • Start date Start date
  • Tags Tags
    Test
AI Thread Summary
To determine the values of m and k in a strong primality test, start with the equation n-1 = m * 2^k, where m is an odd integer. The value of k is derived from how many times 2 can divide n-1 before reaching an odd number, which becomes m. The algorithm involves computing a^m mod n and checking subsequent squares until reaching 1 or -1. If the test yields -1, n is likely prime; otherwise, it is composite. Understanding how to derive m and k is crucial for implementing the strong primality test in programming assignments.
JaeSun
Messages
37
Reaction score
0
strong primality test ... ??

ok, bear with me ...

we learned weak primality tests (given n and base a,::: a^(n-1) mod n ::: if it does not equal 1, then its composite, if it equals 1, then MAYBE prime) ...

then we learned strong primes ... think of n-1 = m2^k when m is odd. test ::: a^m mod n and keep squaring until we get 1 (or past n-1). go back one step, and check if it was -1 (if so, probably prime, if not, then it is composite)

so my homework. I am kinda confused.

I was given this algorithm for the strong primality test

Code:
n-1 = m2^k
A = a^m mod n
if( A=1 )
  "maybe prime
else
  while( A^2 mod n != 1 )
  {
     A = A^2 mod n
  }
  if( A = -1 )
     "maybe prime"
  else
      "composite"

my question is, where does m and k come from??

i been looking at my notes over and over again ... i did read that m is odd, so I can just choose any random odd number ? but then k ? what number is that?

i am kinda lost ...

other notes that i have:

write n-1 = 2^k m
check 2^m, (2^n)^2, ... , (2^m)^(2^k)
if 2^m mod n = 1, n is like a prime. otherwise find first j so that:
(2^m)^(2^j) != 1 and
(2^m)^(2^j+1) = 1
then 2^(m2^j) is a root of x^2-1 =0
if 2^(m2^j) = -1, n is like a prime, if not, n is composite ...

can anyone help??

he went over this in like 1 day, way back in the beginning of the semester, and he just gave us this assignment ... would like any help in understanding this, so I could program this (the assignment is to program numbers that pass weak test, but fail strong test) ...

i don't know where m and k come from, which is what is keeping me from finishing the program ...

grrrrrr
 
Physics news on Phys.org
bump ...

anyone?
 
ANYONE? bump one last time as its due tomorrow and I am still stuck
 
Thread 'Variable mass system : water sprayed into a moving container'
Starting with the mass considerations #m(t)# is mass of water #M_{c}# mass of container and #M(t)# mass of total system $$M(t) = M_{C} + m(t)$$ $$\Rightarrow \frac{dM(t)}{dt} = \frac{dm(t)}{dt}$$ $$P_i = Mv + u \, dm$$ $$P_f = (M + dm)(v + dv)$$ $$\Delta P = M \, dv + (v - u) \, dm$$ $$F = \frac{dP}{dt} = M \frac{dv}{dt} + (v - u) \frac{dm}{dt}$$ $$F = u \frac{dm}{dt} = \rho A u^2$$ from conservation of momentum , the cannon recoils with the same force which it applies. $$\quad \frac{dm}{dt}...
TL;DR Summary: I came across this question from a Sri Lankan A-level textbook. Question - An ice cube with a length of 10 cm is immersed in water at 0 °C. An observer observes the ice cube from the water, and it seems to be 7.75 cm long. If the refractive index of water is 4/3, find the height of the ice cube immersed in the water. I could not understand how the apparent height of the ice cube in the water depends on the height of the ice cube immersed in the water. Does anyone have an...
Back
Top