Solving Mathematical Programming Questions

Solving Mathematical Programming Questions

Important Concepts :

  1. Prime numbers - Number is prime if it can be divided by exactly 2 number 1 and itself. 
    1. 1 is not prime as its not divided by 2 numbers 
    2. Prime numbers are +ve only.
    3. Eg : 1, 2, 3, 5, 7 ... 
    4. 2.. n if i divides n then n is not prime 
    5. Chk only till sqrt(n) that should be enough 
    6. Cofactors - b= n/a ; n=b*a
      1. cofactors of 36 - {1,36}{2,18}{3,12}{4,9}{6,6}{12,3}[18,2}{36,1}
  1. Factors of n 
    1. eg : 12 - 1, 2, 3, 4, 6,12
    2. eg : 17 - 1,17 - n is prime Hence it has only 2 factors 
    3. all numbers are divisible by 1 and itself 
      1. hence chk from 2 - n/2 
      2. Running time = o(n)
    4. Improvising using the principle of cofactors -  it enough to chk 1 to sqrt(n)
      1. o(sqrt(n)
      2. Now based on co factors rule if we get a then n/a is also divisible by n if i!=sqrt(n)

Comments