Skip to content
Snippets Groups Projects
Commit 6eb41707 authored by Goik Martin's avatar Goik Martin
Browse files

Adding graphic explanation

parent 9f661f0b
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
......@@ -2691,9 +2691,18 @@ import java.util.Random;
<qandadiv>
<qandaentry>
<question>
<para>Read the <link
xlink:href="https://en.wikipedia.org/wiki/Pythagorean_triple">definition
of Pythagorean triples</link>.</para>
<para><link
xlink:href="https://en.wikipedia.org/wiki/Pythagorean_triple">Pythagorean
triples</link> are integer combinations of three values being
related by the <link
xlink:href="https://en.wikipedia.org/wiki/Pythagorean_theorem">Pythagorean
theorem</link>:</para>
<mediaobject>
<imageobject>
<imagedata fileref="Ref/Statements/phythagorean.svg"/>
</imageobject>
</mediaobject>
<para>Find all <link
xlink:href="https://en.wikipedia.org/wiki/Pythagorean_triple">Pythagorean
......@@ -2741,8 +2750,7 @@ import java.util.Random;
</inlineequation>.</para>
<tip>
<para>Think of writing a program which creates all possible
triples <inlineequation>
<para>Think of creating all possible triples <inlineequation>
<m:math display="inline">
<m:mrow>
<m:mo>(</m:mo>
......@@ -2807,7 +2815,8 @@ import java.util.Random;
</tr>
</informaltable>
<para>Why does the value 998 appear here?</para>
<para>Why does a value of 838 rather then 840 appears
here?</para>
<para>This list mostly contains values like <inlineequation>
<m:math display="inline">
......@@ -2819,60 +2828,68 @@ import java.util.Random;
<m:mo>,</m:mo>
<m:mn>4</m:mn>
<m:mn>3</m:mn>
<m:mo>,</m:mo>
<m:mn>3</m:mn>
<m:mn>4</m:mn>
</m:mrow>
<m:mo>)</m:mo>
</m:mrow>
</m:math>
</inlineequation> failing to obey our restriction
</inlineequation> failing both our restrictions
<inlineequation>
<m:math display="inline">
<m:mrow>
<m:mrow>
<m:mn>1</m:mn>
<m:mo>+</m:mo>
<m:msup>
<m:mn>1</m:mn>
<m:mn>4</m:mn>
<m:mn>2</m:mn>
</m:msup>
<m:mo>+</m:mo>
<m:mn>3</m:mn>
<m:msup>
<m:mn>3</m:mn>
<m:mn>2</m:mn>
</m:msup>
</m:mrow>
<m:mo></m:mo>
<m:mi>840</m:mi>
<m:msup>
<m:mn>4</m:mn>
<m:mn>2</m:mn>
</m:msup>
</m:mrow>
</m:math>
</inlineequation>. These triples have thus to be filtered
retaining only the desired combinations simultaneously obeying
both <inlineequation>
</inlineequation> and <inlineequation>
<m:math display="inline">
<m:mrow>
<m:mrow>
<m:mi>a</m:mi>
<m:mn>1</m:mn>
<m:mo>+</m:mo>
<m:mi>b</m:mi>
<m:mn>3</m:mn>
<m:mo>+</m:mo>
<m:mi>c</m:mi>
<m:mn>4</m:mn>
</m:mrow>
<m:mo>=</m:mo>
<m:mo></m:mo>
<m:mi>840</m:mi>
</m:mrow>
</m:math>
</inlineequation> and <inlineequation>
</inlineequation>. These triples have thus to be filtered
retaining only the desired combinations simultaneously obeying
both <inlineequation>
<m:math display="inline">
<m:mrow>
<m:mrow>
......@@ -2900,6 +2917,26 @@ import java.util.Random;
</m:msup>
</m:mrow>
</m:math>
</inlineequation> and <inlineequation>
<m:math display="inline">
<m:mrow>
<m:mrow>
<m:mi>a</m:mi>
<m:mo>+</m:mo>
<m:mi>b</m:mi>
<m:mo>+</m:mo>
<m:mi>c</m:mi>
</m:mrow>
<m:mo>=</m:mo>
<m:mi>840</m:mi>
</m:mrow>
</m:math>
</inlineequation>. This might be accomplished by
implementing three nested loops:</para>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment