randRange( 2, 6 ) shuffle( getPrimeFactorization( 60 ).concat( getPrimeFactorization( DISTANCE ) ) ) function( factors ) { var product = 1; for ( var i = 0; i < factors.length; i++ ) { product *= factors[ i ]; } return product; } randRange( 3, FACTORS.length - 2 ) MULTIPLY( FACTORS.slice( 0, SPLIT ) ) MULTIPLY( FACTORS.slice( SPLIT ) ) (function() { if ( RATE_UP % 3 === 0 ) { return 2; } else { return 3; } })() K * RATE_UP 60 * DISTANCE / RATE_DOWN 60 * 2 * DISTANCE / ( TIME_UP + TIME_DOWN ) $._("average speed") $._("total distance") $._("total time") $._("distance uphill") $._("distance downhill") $._("speed uphill") $._("time uphill") $._("mph") $._("minutes") $._("hour") $._("time downhill") $._("speed downhill") $._("miles")

Starting at home, person( 1 ) traveled uphill to the store( 1 ) store for TIME_UP minutes at just RATE_UP mph. He then traveled back home along the same path downhill at a speed of K * RATE_UP mph.

Starting at home, person( 1 ) traveled uphill to the store( 1 ) store for TIME_UP minutes at just RATE_UP mph. She then traveled back home along the same path downhill at a speed of K * RATE_UP mph.

What is his average speed for the entire trip from home to the store( 1 ) store and back?

What is her average speed for the entire trip from home to the store( 1 ) store and back?

RATE_AVG mph

The average speed is not just the average of RATE_UP mph and RATE_DOWN mph.

He traveled for a longer time uphill (since he was going slower), so we can estimate that the average speed is closer to RATE_UP mph than RATE_DOWN mph.

She traveled for a longer time uphill (since she was going slower), so we can estimate that the average speed is closer to RATE_UP mph than RATE_DOWN mph.

To calculate the average speed, we will make use of the following:

\text{AVERAGE_SPEED_TEXT} = \dfrac{\color{KhanUtil.BLUE}{\text{TOTAL_DISTANCE_TEXT}}}{\color{KhanUtil.ORANGE}{\text{TOTAL_TIME_TEXT}}}

\text{DISTANCE_UPHILL} = \text{DISTANCE_DOWNHILL}

What was the total distance traveled?

\color{KhanUtil.BLUE}{\begin{align*}\text{TOTAL_DISTANCE_TEXT} &= \text{DISTANCE_UPHILL} + \text{DISTANCE_DOWNHILL}\\ &= 2 \times \text{DISTANCE_UPHILL}\end{align*}}

\begin{align*}\text{DISTANCE_UPHILL} &= \text{SPEED_UPHILL} \times \text{TIME_UPHILL_TEXT} \\\ &= RATE_UP\text{ MPH_TEXT} \times TIME_UP\text{ MINUTES_TEXT}\times\dfrac{1 \text{ HOUR_TEXT}}{60 \text{ MINUTES_TEXT}}\\ &= DISTANCE\text{ MILES_TEXT}\end{align*}

Substituting to find the total distance:

\color{KhanUtil.BLUE}{\text{TOTAL_DISTANCE_TEXT} = 2 * DISTANCE\text{ MILES_TEXT}}

What was the total time spent traveling?

\color{KhanUtil.ORANGE}{\text{TOTAL_TIME_TEXT} = \text{TIME_UPHILL_TEXT} + \text{TIME_DOWNHILL_TEXT}}

\begin{align*}\text{TIME_DOWNHILL_TEXT} &= \dfrac{\text{DISTANCE_DOWNHILL}}{\text{SPEED_DOWNHILL_TEXT}}\\ &= \dfrac{DISTANCE\text{ MILES_TEXT}}{RATE_DOWN\text{ MPH_TEXT}}\times\dfrac{60 \text{ MINUTES_TEXT}}{1 \text{ HOUR_TEXT}}\\ &= TIME_DOWN\text{ MINUTES_TEXT}\end{align*}

\color{KhanUtil.ORANGE}{\begin{align*}\text{TOTAL_TIME_TEXT} &= TIME_UP\text{ MINUTES_TEXT} + TIME_DOWN\text{ MINUTES_TEXT}\\ &= TIME_UP + TIME_DOWN\text{ MINUTES_TEXT}\end{align*}}

Now that we know both the total distance and total time, we can find the average speed.

\begin{align*}\text{AVERAGE_SPEED_TEXT} &= \dfrac{\color{KhanUtil.BLUE}{\text{TOTAL_DISTANCE_TEXT}}}{\color{KhanUtil.ORANGE}{\text{TOTAL_TIME_TEXT}}}\\ &= \dfrac{\color{KhanUtil.BLUE}{2 * DISTANCE\text{ MILES_TEXT}}}{\color{KhanUtil.ORANGE}{TIME_UP + TIME_DOWN\text{ MINUTES_TEXT}}}\times\dfrac{60 \text{ MINUTES_TEXT}}{1 \text{ HOUR_TEXT}}\\ &= RATE_AVG\text{ MPH_TEXT}\end{align*}

The average speed is RATE_AVG mph, and which is closer to RATE_UP mph than RATE_DOWN mph as we expected.

randRange( 5, 10 ) PEOPLE_INIT randRange( 20, 59 ) randRange( PEOPLE_INIT + 3, 20 ) PEOPLE_FINAL TIME_INIT

It takes TIME_INIT minutes for PEOPLE_INIT people to paint WALL_INIT walls.

How many minutes does it take PEOPLE_FINAL people to paint WALL_FINAL walls?

TIME_FINAL minutes

Imagine that each person is assigned one wall, and all PEOPLE_INIT people begin painting at the same time.

Since everyone will finish painting their assigned wall after TIME_INIT minutes, it takes one person TIME_INIT minutes to paint one wall.

If we have PEOPLE_FINAL people and WALL_FINAL walls, we can again assign one wall to each person.

Everyone will take TIME_FINAL minutes to paint their assigned wall.

In other words, it takes TIME_FINAL minutes for PEOPLE_FINAL people to paint WALL_FINAL walls.

randRangeUnique( 3, 7, 2 ) randRange( 30, 50 ) randRange( PEOPLE_INIT + 1, 10 ) randRange( WALL_INIT + 1, 10 ) round( WALL_FINAL * TIME_INIT * PEOPLE_INIT / ( WALL_INIT * PEOPLE_FINAL ) ) getGCD( WALL_FINAL * TIME_INIT * PEOPLE_INIT, WALL_INIT * PEOPLE_FINAL ) !== (WALL_INIT * PEOPLE_FINAL) $._("walls") $._("people") $._("minutes") $._("walls painted per minute per person")

PEOPLE_INIT people can paint WALL_INIT walls in TIME_INIT minutes.

How many minutes will it take for PEOPLE_FINAL people to paint WALL_FINAL walls? Round to the nearest minute.

TIME_FINAL minutes

the number of minutes, rounded to the nearest minute

We know the following about the number of walls w painted by p people in t minutes at a constant rate r.

w = r \cdot t \cdot p

\begin{align*}w &= WALL_INIT\text{ WALLS_TEXT}\\ p &= PEOPLE_INIT\text{ PEOPLE_TEXT}\\ t &= TIME_INIT\text{ MINUTES_TEXT}\end{align*}

Substituting known values and solving for r:

r = \dfrac{w}{t \cdot p}= \dfrac{WALL_INIT}{TIME_INIT \cdot PEOPLE_INIT} = fractionReduce( WALL_INIT, TIME_INIT * PEOPLE_INIT )\text{ WALLS_PAINTED_PER_MINUTE_PER_PERSON}

We can now calculate the amount of time to paint WALL_FINAL walls with PEOPLE_FINAL people.

t = \dfrac{w}{r \cdot p} = \dfrac{WALL_FINAL}{fractionReduce( WALL_INIT, TIME_INIT * PEOPLE_INIT ) \cdot PEOPLE_FINAL} = \dfrac{WALL_FINAL}{fractionReduce( WALL_INIT * PEOPLE_FINAL, TIME_INIT * PEOPLE_INIT )} = fractionReduce( WALL_FINAL * TIME_INIT * PEOPLE_INIT, WALL_INIT * PEOPLE_FINAL )\text{ MINUTES_TEXT}= mixedFractionFromImproper( WALL_FINAL * TIME_INIT * PEOPLE_INIT, WALL_INIT * PEOPLE_FINAL, true, true )\text{ MINUTES_TEXT}

Round to the nearest minute:

t = TIME_FINAL\text{ MINUTES_TEXT}