diff --git a/exercises/converting_repeating_decimals_to_fractions_1.html b/exercises/converting_repeating_decimals_to_fractions_1.html index 07e615470..a7371cdd3 100644 --- a/exercises/converting_repeating_decimals_to_fractions_1.html +++ b/exercises/converting_repeating_decimals_to_fractions_1.html @@ -7,40 +7,70 @@
-
- randRange( 0, 3 ) - randRange( 1, 8 ) - N1 + N2 / 9 - - 0 - 1 - - round( pow( 10, D2 ) ) - round( pow( 10, D1 ) ) - floorTo( 4,( MULT1 * N4 ) ) - floorTo( 4,( MULT2 * N4 ) ) - round( RES1 - RES2 ) -
-
-
-

Rewrite as a simplified fraction.

+
+
+ randRange( 0, 3 ) + randRange( 1, 8 ) + N1 + N2 / 9 + + 0 + 1 + + round( pow( 10, D2 ) ) + round( pow( 10, D1 ) ) + floorTo( 4,( MULT1 * N4 ) ) + floorTo( 4,( MULT2 * N4 ) ) + round( RES1 - RES2 ) +
+ +

Rewrite as a simplified fraction.

\large{N1.\overline{N2} = {?}}

N4

+
+

Let x equal the decimal. Set up two equations such that the digits after the decimal point are identical.

+

\large{\begin{align*}MULT1x &= RES1...\\ + MULT2x &= RES2...\end{align*}}

+
+

Subtracting the two equations, we have:

+

\large{(MULT1 - MULT2)x = DIFF}

+
+

\large{x = fraction( DIFF, MULT1 - MULT2 )}\quad \text{or} \quad\large{mixedFractionFromImproper( DIFF, MULT1 - MULT2 )}

+

\large{x = fraction( toFraction( N4 )[ 0 ], toFraction( N4 )[ 1 ])}\quad \text{or} \quad\large{mixedFractionFromImproper( toFraction( N4 )[ 0 ], toFraction( N4 )[ 1 ] )}

+
-
-
-

Let x equal the decimal. Set up two equations such that the digits after the decimal point are identical.

-

\large{\begin{align*}MULT1x &= RES1...\\ - MULT2x &= RES2...\end{align*}}

-
-

Subtracting the two equations, we have:

-

\large{(MULT1 - MULT2)x = DIFF}

+
+
+ randRange(4,10) + randRange(1,DEN_PRIME-1) + + 9 + (randRange(0,2)*9) + randRange(1,8) + + toFraction(NUM_9/DEN_9)[1] + toFraction(NUM_9/DEN_9)[0] + Math.floor(NUM_9/DEN_9) + roundTo(9, NUMERATOR/DENOMINATOR) + +
+ +

Rewrite as a decimal. Give the first 10 digits.

+

\large{NUMERATOR/DENOMINATOR = {?}}

+

DEC_SOL

+ +
+

Divide the numerator by the denominator so we only have to work with the remainder, which will be easier. Remember the quotient!

+ +

Divide NUMERATOR by DENOMINATOR. You should find that one digit keeps on repeating.

+ +

Don't forget to add the quotient before the period.

+ +

The answer is DEC_SOL

+
-

\large{x = fraction( DIFF, MULT1 - MULT2 )}\quad \text{or} \quad\large{mixedFractionFromImproper( DIFF, MULT1 - MULT2 )}

-

\large{x = fraction( toFraction( N4 )[ 0 ], toFraction( N4 )[ 1 ])}\quad \text{or} \quad\large{mixedFractionFromImproper( toFraction( N4 )[ 0 ], toFraction( N4 )[ 1 ] )}

-
+ +
diff --git a/exercises/converting_repeating_decimals_to_fractions_2.html b/exercises/converting_repeating_decimals_to_fractions_2.html index ab82dceba..b992c8464 100644 --- a/exercises/converting_repeating_decimals_to_fractions_2.html +++ b/exercises/converting_repeating_decimals_to_fractions_2.html @@ -1,89 +1,123 @@ - + + - - Converting multi-digit repeating decimals to fractions - + + + + Converting multi-digit repeating decimals to fractions + + -
+
- randRangeWeighted( 0, 3, 0, 0.5 ) - randRange( 1, 8 ) - randRange( 10, 99 ) - N1 + N2 / 9 - - 0 - 1 - - pow( 10, D2 ) - pow( 10, D1 ) - floorTo( 4,( MULT1 * N4 ) ) - floorTo( 4,( MULT2 * N4 ) ) - round( RES1 - RES2 ) + randRangeWeighted( 0, 3, 0, 0.5 ) randRange( 1, 8 ) randRange( 10, 99 ) N1 + N2 / 9 0 1 pow( 10, D2 ) pow( 10, D1 ) floorTo( 4,( MULT1 * N4 ) ) floorTo( 4,( MULT2 * N4 ) ) round( RES1 - RES2 )
-
-

Rewrite as a simplified fraction.

-

\large{N1.\overline{N2} = {?}}

-

N4

-
-
-
- N1 + N3 / 99 - 2 + +
+

Rewrite as a decimal. Give the first 10 digits.

+

\large{NUMERATOR/DENOMINATOR = {?}}

+

DEC_SOL

+ +
+ ((randRange(0,1)*9)+(randRange(0,1)*90)+(randRange(0,1)*900)) || 1 + (randRange(0,2)*DEN_9) + randRange(1,DEN_9) + + toFraction(NUM_9/DEN_9)[1] + toFraction(NUM_9/DEN_9)[0] + Math.floor(NUM_9/DEN_9) + roundTo(9, NUMERATOR/DENOMINATOR)
-

Rewrite as a simplified fraction.

-

\large{N1.\overline{N3} = {?}}

-

N4

-
-
-
- randRange( 1, 8 ) - N1 + N2 / 10 + N3 / 90 - 1 - 2 + +
+

Divide the numerator by the denominator so we only have to work with the remainder, which will be easier. Remember the quotient!

+ +

Divide (NUMERATOR%DENOMINATOR) by DENOMINATOR. You should find that some digits keep on repeating.

+ +

Divide NUMERATOR by DENOMINATOR. You should find that some digits keep on repeating.

+ +

Don't forget to add the quotient before the period.

+ +

The answer is DEC_SOL

-

Rewrite as a simplified fraction.

-

\large{N1.N2\overline{N3} = {?}}

-

N4

-
-
- randRange( 1, 9 ) - N1 + N2 / 10 + N3 / 990 - 1 - 3 -
-

Rewrite as a simplified fraction.

-

\large{N1.N2\overline{N3} = {?}}

-

N4

+ +
+

Rewrite as a simplified fraction.

+ +

\large{N1.\overline{N2} = {?}}

+ +

N4

+
+ +
+
+ N1 + N3 / 99 2
-
-
- randRange( 1, 8 ) - N1 + N3 / 100 + N2 / 900 - 2 - 3 -
-

Rewrite as a simplified fraction.

-

\large{N1.N3\overline{N2} = {?}}

-

N4

+ +

Rewrite as a simplified fraction.

+ +

\large{N1.\overline{N3} = {?}}

+ +

N4

+
+ +
+
+ randRange( 1, 8 ) N1 + N2 / 10 + N3 / 90 1 2
-
-
-

Let x equal the decimal. Set up two equations such that the digits after the decimal point are identical.

-

\large{\begin{align*}MULT1x &= RES1...\\ - MULT2x &= RES2...\end{align*}}

-
-

Subtracting the two equations, we have:

-

\large{(MULT1 - MULT2)x = DIFF}

+

Rewrite as a simplified fraction.

+ +

\large{N1.N2\overline{N3} = {?}}

+ +

N4

+
+ +
+
+ randRange( 1, 9 ) N1 + N2 / 10 + N3 / 990 1 3 +
+ +

Rewrite as a simplified fraction.

+ +

\large{N1.N2\overline{N3} = {?}}

+ +

N4

+
+ +
+
+ randRange( 1, 8 ) N1 + N3 / 100 + N2 / 900 2 3
-

\large{x = fraction( DIFF, MULT1 - MULT2 )}\quad \text{or} \quad\large{mixedFractionFromImproper( DIFF, MULT1 - MULT2 )}

-

\large{x = fraction( toFraction( N4 )[ 0 ], toFraction( N4 )[ 1 ])}\quad \text{or} \quad\large{mixedFractionFromImproper( toFraction( N4 )[ 0 ], toFraction( N4 )[ 1 ] )}

+ +

Rewrite as a simplified fraction.

+ +

\large{N1.N3\overline{N2} = {?}}

+ +

N4

+
+ +
+

Let x equal the decimal. Set up two equations such that the digits after the decimal point are identical.

+ +

\large{\begin{align*}MULT1x &= RES1...\\ MULT2x &= RES2...\end{align*}}

+ +
+

Subtracting the two equations, we have:

+ +

\large{(MULT1 - MULT2)x = DIFF}

+
+ +

\large{x = fraction( DIFF, MULT1 - MULT2 )}\quad \text{or} \quad\large{mixedFractionFromImproper( DIFF, MULT1 - MULT2 )}

+ +

\large{x = fraction( toFraction( N4 )[ 0 ], toFraction( N4 )[ 1 ])}\quad \text{or} \quad\large{mixedFractionFromImproper( toFraction( N4 )[ 0 ], toFraction( N4 )[ 1 ] )}

+