Showing posts with label division. Show all posts
Showing posts with label division. Show all posts

Friday, November 7, 2008

Simple division technique

This division technique can only be used if the divisor could be factorized.

Example 1:


272 ÷ 16 = 17

  1. Find the factors of the divisor. Choose one of the factors. 16 = 4 × 4 or 16 = 8 × 2 For example, I will use 8 × 2

  2. Divide the dividend by one of the factor. 272 ÷ 8 = 34

  3. Divide the quotient from 2. by the second factor. 34 ÷ 2 = 17

  4. Therefore, the quotient is 17


Note: Try with 4 × 4. What will happened if the remainder is not zero? Please look at the next example.

Example 2:


275 ÷ 16 = 17 with remainder 3

  1. 16 = 4 × 4

  2. 275 ÷ 4 = 68, r. 3

  3. 68 ÷ 4 = 17

  4. The quotient is 17, with remainder 3


Note: Try with 2 × 8

Monday, November 3, 2008

Remainder when a number is divided by a nine

Do you know that there is an easy way to find the remainder when a number is divided by 9?

Example 1:

43 ÷ 9 = 4, remainder = 7

quick remainder: 4 + 3 = 7

Example 2:


28 ÷ 9 = 3, remainder = 1

quick remainder: 2 + 8 = 10 ?

If the addition is ? 9, cast out the 9s, until it is lest than 9.

10 – 9 = 1

Example 3:


2345 ÷ 9 = 260, remainder = 5

quick remainder: 2 + 3 + 4 + 5 = 14

14 – 9 = 5

Example 4:


4489 ÷ 9 = 498, remainder = 7

quick remainder: 4 + 4 + 8 + 9 = 25

25 – 9 = 16

16 – 9 = 7

Wednesday, April 16, 2008

Python: Make division always produce real numbers

A division of 7/3 in Python will gives a result of 2. However, this is not correct. Since Python always assume that the numbers are whole numbers, the result will be truncated from 2.5 to 2.

A work around is to write one or both of the numbers as a decimal:
>>> print 7/3.0
2.5

>>> print 7.0/3
2.5

>>> print 7.0/3.0
2.5
In order to change this behaviour of Python, throughout the program execution, so that Python will always produce real numbers, a module division has to be imported.
>>> from __future__ import division

>>> print 7/3
2.5