## A fraction represents a part of a whole.

A fraction consists of a numerator displayed above a line, and a denominator below.

- An
**proper fraction**must be less than 1, like`3/4`

and`7/12`

. - An
**improper fraction**is more than 1, like`9/2`

and`13/4`

. - A
**mixed fraction**is a whole number and a portion less than 1 together, like`2 3/4`

. - A
**reciprocal**is another fraction with the numerator and denominator exchanged, like`3/7`

for`7/3`

.

An interesting aspect of fractions and prime factorization is that multiplying fractions is the same as adding the prime numerators and subtracting the prime denominators.

Multiplication | ||
---|---|---|

42 | 5 / 14 | 15 |

2^{1} x 3^{1} x 7^{1} / 1 |
5^{+1} / 2^{-1} x 7^{-1} |
3^{1} x 5^{1} / 1 |

For example, multiplying 42 by `5/14`

means incrementing the power of prime 5, and decrementing the power of primes 2 and 7 — For a result of 42. A division is simply the inversion of the effects of the numerator and denumerator.

Division | ||
---|---|---|

15 | 5 / 14 | 42 |

3^{1} x 5^{1} / 1 |
5^{-1} / 2^{+1} x 7^{+1} |
2^{1} x 3^{1} x 7^{1} / 1 |

## 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

This particularity serves as the basis for the Fractran programming language, it is also of interest for reversible computation.

### 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.

**incoming** cccc arithmetic fractran