Skip to main content
Logo image

PreTeXt Sample Book Abstract Algebra (SAMPLE ONLY)

Exercises 2.6 Sage Exercises

View Source for exercises
  <exercises xml:id="integers-sage-exercises" xml:base="sage/integers-sage-exercises.xml">

<title>Sage Exercises</title>

<introduction>

  <p>
    These exercises are about investigating basic properties of the integers, something we will frequently do when investigating groups.
    Use the editing capabilities of a Sage worksheet to annotate and explain your work.
  </p>

</introduction>

<exercise number="1">

  <statement>

    <p>
      Use the <c>next_prime()</c> command to construct two different 8-digit prime numbers and save them in variables named <c>a</c> and <c>b</c>.
    </p>

  </statement>

</exercise>

<exercise number="2">

  <statement>

    <p>
      Use the <c>.is_prime()</c> method to verify that your primes <c>a</c> and <c>b</c> are really prime.
    </p>

  </statement>

</exercise>

<exercise number="3">

  <statement>

    <p>
      Verify that <m>1</m> is the greatest common divisor of your two primes from the previous exercises.
    </p>

  </statement>

</exercise>

<exercise number="4">

  <statement>

    <p>
      Find two integers that make a <q>linear combination</q> of your two primes equal to <m>1</m>.
      Include a verification of your result.
    </p>

  </statement>

</exercise>

<exercise number="5">

  <statement>

    <p>
      Determine a factorization into powers of primes for <m>c=4\,598\,037\,234</m>.
    </p>

  </statement>

</exercise>

<exercise number="6">

  <statement>

    <p>
      Write a compute cell that defines the same value of <c>c</c> again, and then defines a candidate divisor of <c>c</c> named <c>d</c>.
      The third line of the cell should return <c>True</c> if and only if <c>d</c> is a divisor of <c>c</c>.
      Illustrate the use of your cell by testing your code with <m>d=7</m> and in a new copy of the cell, testing your code with <m>d=11</m>.
    </p>

  </statement>

</exercise>

</exercises>
These exercises are about investigating basic properties of the integers, something we will frequently do when investigating groups. Use the editing capabilities of a Sage worksheet to annotate and explain your work.

1.

View Source for exercise
<exercise number="1">

  <statement>

    <p>
      Use the <c>next_prime()</c> command to construct two different 8-digit prime numbers and save them in variables named <c>a</c> and <c>b</c>.
    </p>

  </statement>

</exercise>
Use the next_prime() command to construct two different 8-digit prime numbers and save them in variables named a and b.

2.

View Source for exercise
<exercise number="2">

  <statement>

    <p>
      Use the <c>.is_prime()</c> method to verify that your primes <c>a</c> and <c>b</c> are really prime.
    </p>

  </statement>

</exercise>
Use the .is_prime() method to verify that your primes a and b are really prime.

3.

View Source for exercise
<exercise number="3">

  <statement>

    <p>
      Verify that <m>1</m> is the greatest common divisor of your two primes from the previous exercises.
    </p>

  </statement>

</exercise>
Verify that \(1\) is the greatest common divisor of your two primes from the previous exercises.

4.

View Source for exercise
<exercise number="4">

  <statement>

    <p>
      Find two integers that make a <q>linear combination</q> of your two primes equal to <m>1</m>.
      Include a verification of your result.
    </p>

  </statement>

</exercise>
Find two integers that make a β€œlinear combination” of your two primes equal to \(1\text{.}\) Include a verification of your result.

5.

View Source for exercise
<exercise number="5">

  <statement>

    <p>
      Determine a factorization into powers of primes for <m>c=4\,598\,037\,234</m>.
    </p>

  </statement>

</exercise>
Determine a factorization into powers of primes for \(c=4\,598\,037\,234\text{.}\)

6.

View Source for exercise
<exercise number="6">

  <statement>

    <p>
      Write a compute cell that defines the same value of <c>c</c> again, and then defines a candidate divisor of <c>c</c> named <c>d</c>.
      The third line of the cell should return <c>True</c> if and only if <c>d</c> is a divisor of <c>c</c>.
      Illustrate the use of your cell by testing your code with <m>d=7</m> and in a new copy of the cell, testing your code with <m>d=11</m>.
    </p>

  </statement>

</exercise>
Write a compute cell that defines the same value of c again, and then defines a candidate divisor of c named d. The third line of the cell should return True if and only if d is a divisor of c. Illustrate the use of your cell by testing your code with \(d=7\) and in a new copy of the cell, testing your code with \(d=11\text{.}\)