[ { str: "milli", math: "\\dfrac{1}{1000}", inverse: "1000" }, { str: "centi", math: "\\dfrac{1}{100}", inverse: "100" }, { str: "deci", math: "\\dfrac{1}{10}", inverse: "10" }, { str: "", math: "1" }, { str: "deca", math: "10", inverse: "\\dfrac{1}{10}" }, { str: "hecto", math: "100", inverse: "\\dfrac{1}{100}" }, { str: "kilo", math: "1000", inverse: "\\dfrac{1}{1000}" } ] shuffle( [ "meter", "liter", "gram", "watt" ] ).shift() randRange( 100, 999 ) randRangeNonZero( -3, 3 ) PREFIXES[ START_POWER + 3 ] START_PREFIX.str + UNIT randRangeExclude( -3, 3, [ 0, START_POWER ] ) PREFIXES[ END_POWER + 3 ] END_PREFIX.str + UNIT roundTo( 6, QUANTITY * pow( 10, START_POWER - END_POWER ) )
How many END_UNITs are in QUANTITY + " " + START_UNITs?
SOLUTION

The following table shows a few prefixes and their meanings.

PrefixMeaning
prefix.strprefix.math

Looking at the table, we see that 1 START_UNIT corresponds to START_PREFIX.math UNITs.

We can also see that, 1 END_UNIT corresponds to END_PREFIX.math UNITs.

QUANTITY \text{ START_UNITs } \cdot START_PREFIX.math \dfrac{ \text{ UNIT } }{ \text{ START_UNIT } } \cdot END_PREFIX.inverse \dfrac{ \text{END_UNIT} }{ \text{ UNIT } }

= QUANTITY \cdot 10^{START_POWER - END_POWER} \text{ END_UNITs }

= commafy( SOLUTION ) \text{ END_UNITs}

[ { str: "mile", plural: "miles", multiplier: 63360 }, { str: "foot", plural: "feet", multiplier: 12 }, { str: "inch", plural: "inches", multiplier: 1 } ] [ { str: "hour", plural: "hours", multiplier: 3600 }, { str: "minute", plural: "minutes", multiplier: 60 }, { str: "second", plural: "seconds", multiplier: 1 } ] shuffle( [0, 1, 2] ) D_INDICES.shift() D_INDICES.shift() shuffle( [0, 1, 2] ) T_INDICES.shift() T_INDICES.shift() (function() { var hint = ""; var increment = (END_D_INDEX - START_D_INDEX) > 0 ? 1 : -1; for ( var i = START_D_INDEX; i != END_D_INDEX; i += increment ) { var factor = fractionReduce( D_UNITS[i].multiplier, D_UNITS[i + increment].multiplier ); if ( !factor.match( "dfrac" ) ) { factor = "\\dfrac{" + factor + "}{1}" } var units = factor + "\\dfrac{\\text{" + D_UNITS[i + increment].plural + "}}{\\text{" + D_UNITS[i].str + "}}"; hint += "\\cdot" + units; } return hint; })() (function() { var hint = ""; var increment = (END_T_INDEX - START_T_INDEX) > 0 ? 1 : -1; for ( var i = START_T_INDEX; i != END_T_INDEX; i += increment ) { var factor = fractionReduce( T_UNITS[i + increment].multiplier, T_UNITS[i].multiplier ); if ( !factor.match( "dfrac" ) ) { factor = "\\dfrac{" + factor + "}{1}" } var units = factor + "\\dfrac{\\text{" + T_UNITS[i].plural + "}}{\\text{" + T_UNITS[i + increment].str + "}}"; hint += "\\cdot" + units; } return hint; })() (D_UNITS[START_D_INDEX].multiplier / D_UNITS[END_D_INDEX].multiplier) * (T_UNITS[END_T_INDEX].multiplier / T_UNITS[START_T_INDEX].multiplier) (function() { var speed = randRange( 20, 50 ); if ( SCALE > 1000 ){ speed = speed / 1000; } else if ( SCALE < 0.001 ) { speed = speed * 1000 * 1000; } while ( ( speed * SCALE > 10) && ( speed > 100 ) ) { speed = Math.round( speed / 10 ); } return speed; })() roundTo( 3, SCALE * START_SPEED ).toFixed( 3 )
An alien rocketship is traveling at a speed of commafy( START_SPEED ) D_UNITS[START_D_INDEX].plural per T_UNITS[START_T_INDEX].str. At this speed, how many D_UNITS[END_D_INDEX].plural will it travel in 1 T_UNITS[END_T_INDEX].str? Round to the nearest thousandth.
SOLUTION

commafy( START_SPEED ) \dfrac{\text{D_UNITS[START_D_INDEX].plural}}{\text{T_UNITS[START_T_INDEX].str}} D_HINT + " " + T_HINT

= commafy( SOLUTION ) \dfrac{\text{D_UNITS[END_D_INDEX].str}}{\text{T_UNITS[END_T_INDEX].str}}