Computer Science Canada

Fraction Help

Author:  KONjbnj [ Thu May 25, 2006 12:56 pm ]
Post subject:  Fraction Help

I have everything in the assignment done except for one part that I can't figure out. I have to reduce large fractions to its smallest form (ie 20/48). I can do easy ones like 2/12 and stuff, but ones where it doesn't equally reduce is confusing. I'll show you what I have, and tell me how I should go about doing it. Do I need to modify one of the ways that I already reduce fractions, or do I need to do it in a whole new way?

Author:  Cervantes [ Thu May 25, 2006 5:20 pm ]
Post subject:  Re: Fraction Help

KONjbnj wrote:
Do I need to modify one of the ways that I already reduce fractions, or do I need to do it in a whole new way?


You should be able to reduce all fractions with one system. Though perhaps some optimizations for specific cases (such as 2/12, where the numerator is a factor of the denominator) could be good.

The general way to reduce a fraction is as follows:

  1. Factor both numerator and denominator into their prime factors
  2. Cancel prime factors that are common to both numerator and denominator
  3. Calculate new numerator and denominator by multiplying out the prime factors that remain for each


: