A fraction represents a part of a whole.
A fraction consists of a numerator displayed above a line, and a denominator below.
Number | Primes | ||
---|---|---|---|
2 | 3 | 5 | |
2/3 | 1 | 1 | 0 |
27/25 | 0 | 3 | 2 |
100/9 | 2 | 2 | 2 |
Multiplying a number by a fraction, is the same as adding the prime numerators and subtracting the prime denominators. For example, multiplying 18, which is made of 2^1 x 3^2
, by 2/3
means incrementing prime 2, and decrementing the prime 3, or 2^2 x 3^1
.
- An proper fraction must be less than 1, like
3/4
and7/12
. - An improper fraction is more than 1, like
9/2
and13/4
. - The reciprocal of a fraction is another fraction with the numerator and denominator exchanged, like
3/7
for7/3
.
To experiment with primes, have a look at Fractran.
Reducing
Dividing the numerator and denominator of a fraction by the same non-zero number yields an equivalent fraction: if the numerator and the denominator of a fraction are both divisible by a number (called a factor) greater than 1, then the fraction can be reduced to an equivalent fraction with a smaller numerator and a smaller denominator.
Recursive Method
function gcd(a, b) if b = 0 return a else return gcd(b, a mod b)
Comparing
Comparing fractions with the same positive denominator yields the same result as comparing the numerators.
Addition/Subtraction
To add fractions containing unlike quantities , it is necessary to convert all amounts to like quantities.
1/4 + 1/3 1*3/4*3 + 1*4/3*4 3/12 + 4/12 = 7/12
The process for subtracting fractions is, in essence, the same as that of adding them: find a common denominator, and change each fraction to an equivalent fraction with the chosen common denominator.
Multiplication
To multiply fractions, multiply the numerators and multiply the denominators.
2/3 * 3/4 = 6/12