Results 1 to 3 of 3

Math Help - need help !!

  1. #1
    monkyshines
    Guest

    need help !!

    i have 2 question that i need help to solve

    1. write an algorithm that writes the binary form of a decimal number n

    2. if d divides both n and m the d divides their sum and d divides their difference
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Super Member

    Joined
    May 2006
    From
    Lexington, MA (USA)
    Posts
    11,909
    Thanks
    772
    Hello, monkyshines!

    \text{2. If }d\text{ divides both }m\text{ and }n\text{, then }d\text{ divides }m+n\text{ and }m-n.

    \text{Since }d\text{ divides }m\text{, then: }\:m \:= \:da\text{, for some integer }a.

    \text{Since }d\text{ divides }n\text{, then: }\:n \:= \:db\text{, for some integer }b.


    \text{Their sum is: }m+n \:=\:da + db \:=\:d(a+b)\text{, which is divisible by }d.

    \text{Their difference is: }m-n \:=\:da-db \:=\:d(a-b)\text{, which is divisible by }d.

    Follow Math Help Forum on Facebook and Google+

  3. #3
    Super Member

    Joined
    May 2006
    From
    Lexington, MA (USA)
    Posts
    11,909
    Thanks
    772
    Hello, monkyshines!

    1. Write an algorithm that writes the binary form of a decimal number n.

    There is a procedure for this, based on the Euclidean Algorithm.


    Example: Convert 87 to binary.


    [1] Divide by 2, note the remainder.

    . . . 87 \div 2 \:=\:43\quad \text{Rem . 1}


    [2] Divide the quotient by 2, note the remainder.

    . . . 43 \div 2 \:=\:21\quad \text{Rem. 1}


    [3] Repeat step [2] until a zero quotient is reached.

    . . . \begin{array}{cccc}21 \div 2 &=&10 & \text{Rem. 1} \\<br />
10 \div 2 &=& 5 & \text{Rem. 0} \\<br />
5 \div 2 &=& 2 & \text{Rem. 1} \\<br />
2 \div 2 &=&1 & \text{Rem. 0} \\<br />
1 \div 2 &=&0 &\text{Rem. 1} \end{array}


    [4] Now read up (\uparrow) the remainders.


    Therefore: . 87_{10} \;=\;1,010,111_2

    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

    A silly but true story . . .

    Years ago, I gave this exact problem on an exam.

    One of my top students (with a quirky sense of humor) wrote
    . . "Hi-yo, Silver!" next to his (correct) answer.

    Of course, when I handed the papers back, I asked him about it.
    He said, "Did you read the number?"

    Puzzled, I mentally thought: "One-zero-one-zero-one-one-one."

    OMG ... It's the opening of The William Tell Overture !

    (I said he was quirky, didn't I?)

    Follow Math Help Forum on Facebook and Google+


/mathhelpforum @mathhelpforum