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 ) ) (RATE_UP % 3 === 0 ? 2 : 3) * 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 RATE_DOWN 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 RATE_DOWN 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{\blue{\text{TOTAL_DISTANCE_TEXT}}}{\pink{\text{TOTAL_TIME_TEXT}}}

\text{DISTANCE_UPHILL} = \text{DISTANCE_DOWNHILL}

What was the total distance traveled?

\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:

\blue{\text{TOTAL_DISTANCE_TEXT} = 2 * DISTANCE\text{ MILES_TEXT}}

What was the total time spent traveling?

\pink{\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*}

\pink{\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{\blue{\text{TOTAL_DISTANCE_TEXT}}}{\pink{\text{TOTAL_TIME_TEXT}}} \\ &= \dfrac{\blue{2 * DISTANCE\text{ MILES_TEXT}}} {\pink{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, 10, 2) randRangeExclude(3, 10, [PEOPLE_INIT]) randRangeExclude(3, 10, [WALL_INIT]) WALL_INIT * PEOPLE_FINAL / getGCD(WALL_FINAL * PEOPLE_INIT, WALL_INIT * PEOPLE_FINAL) randRange(floor(30 / DENOM), ceil(60 / DENOM)) * DENOM WALL_FINAL * TIME_INIT * PEOPLE_INIT / (WALL_INIT * PEOPLE_FINAL)

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

First calculate how long it will take one person to paint one wall.

It will take \dfrac{1}{WALL_INIT} of the time to paint one wall. So it will take fractionReduce(TIME_INIT, WALL_INIT) minutes for PEOPLE_INIT people to paint one wall.

For only one person, it will take PEOPLE_INIT times as long, so it will take fractionReduce(TIME_INIT, WALL_INIT) \cdot PEOPLE_INIT = fractionReduce(TIME_INIT * PEOPLE_INIT, WALL_INIT) minutes for one person to paint one wall.

So, the number of minutes it will take for one person to paint WALL_FINAL walls is fractionReduce(TIME_INIT * PEOPLE_INIT, WALL_INIT) \cdot WALL_FINAL = fractionReduce(TIME_INIT * PEOPLE_INIT * WALL_FINAL, WALL_INIT).

The number of minutes it will take for PEOPLE_FINAL people to paint WALL_FINAL walls is fractionReduce(TIME_INIT * PEOPLE_INIT * WALL_FINAL, WALL_INIT) \div PEOPLE_FINAL = TIME_FINAL.