Exercise 3

advertisement
3. Elementary Number Theory and Methods of Proof
Nancy L. Hagelgans
Number Theory and DERIVE
The mathematical system DERIVE has several predefined functions that are related to
number theory:
FACTOR
FLOOR
MOD
GCD
LCM
NEXT_PRIME
(which also can be accessed with the command SIMPLIFY
FACTOR)
(the greatest integer function)
(nonnegative remainder)
(greatest common divisor)
(least common multiple)
(the next larger prime number)
Also, there are related predicates in DERIVE:
NUMBER
PRIME
(test for rational number)
(test for prime number)
Exercises A.
Author and simplify the following DERIVE expressions. As usual, before each
simplification by DERIVE, anticipate the result. Also try other expressions until you understand
the way that each function behaves, and consult DERIVE’s help system. Then answer the
questions below.
FACTOR(27)
FACTOR(234)
FACTOR(1/12 + 1/10)
FLOOR(2.15)
FLOOR(-2.15)
FLOOR(-3)
FLOOR(0)
FLOOR(1,3)
FLOOR(-1,5)
MOD(3,2)
MOD(-3,2)
MOD(0,0)
VECTOR( [N, MOD(N,0)], N, -5, 4 )
GCD(12, 15)
GCD(12, 15, 18, 30)
GCD(-12, 15)
LCM(12, 15)
LCM(12, 15, 20)
GCD(12, 15) * LCM(12, 15) = 12 * 15
IF(GCD(12, 15) * LCM(12, 15) = 12 * 15)
IF(NOT (GCD(12, 15) * LCM(12, 15) = 12 * 15))
VECTOR(VECTOR(IF(GCD(A,B)*LCM(A,B)=A*B), A, 1, 20), B, 1, 10)
NUMBER(-32)
NUMBER(PI)
NUMBER(3/4)
NUMBER(-3.14159)
VECTOR( [N, IF( NUMBER(SQRT(N)) )], N, 1, 10 )
NEXT_PRIME(3)
NEXT_PRIME(4.1)
VECTOR( NEXT_PRIME(N), N, -10, 10)
PRIME(1)
PRIME(2)
VECTOR( [N, PRIME(N)], N, -5, 5 )
VECTOR( [N, IF(PRIME(N))], N, -5, 5 )
1. Define a DERIVE function CEILING, the least integer function. For example, we want:
CEILING(1.2) = 2,
CEILING(-3.5) = -3, and
CEILING(5) = 5 .
Test your function, and explain why it returns the desired result.
2. Define a DERIVE predicate IS_PRIME that returns 1 or 0 depending on whether or not the
input positive integer is prime. For example, this function should yield the following results:
IS_PRIME(1) = 0,
IS_PRIME(5) = 1, and
IS_PRIME(12) = 0 .
Do not use the predefined DERIVE function PRIME, which is another predicate that tests an
integer to see if the integer is prime. Also, do not use the predefined function NEXT_PRIME.
Test your function. Explain the definition.
3. Describe all integers a, b, and c for which the following statement is true:
If a divides c and b divides c, then ab divides c.
Use DERIVE to generate many examples, and then make a conjecture. Prove your conjecture.
Hint: Use the VECTOR function to generate tables of the vector [a,b,c,t], where t is the truth
value of the given statement for the particular values of a, b, and c.
Exercises B.
1. Write a function NTHPRIME that returns the nth prime when given a positive integer n. We
want the following values for this function:
NTHPRIME(1) = 2,
NTHPRIME(2) = 3,
NTHPRIME(3) = 5, and
NTHPRIME(4) = 7.
Do not use the predefined functions PRIME and NEXT_PRIME.
Test your function, and write an explanation justifying its definition.
2. Use DERIVE to generate examples that will help you answer the following questions. Then
precisely state and prove each of your conclusions.
(a) Is there a nonnegative integer e such that GCD(a, e) = a for every nonnegative integer a?
(b) Is there a nonnegative integer e such that LCM(a, e) = a for every nonnegative integer a?
(c) If e of the preceding question exists, for which nonnegative integers a does there exist a
nonnegative integer a' such that LCM(a, a') = e .
Exercises C.
Suppose that a and b are integers. Consider the following equalities:
GCD(a, b) = GCD(a + b, a - b)
(*)
2 * GCD(a, b) = GCD(a + b, a - b)
(**)
Use examples generated by DERIVE to help you answer the questions below. Then precisely
state and prove your four conclusions.
1. For which integers a and b does the equality (*) hold?
2. For which integers a and b does the equality (**) hold?
3. For which integers a and b do both equalities hold?
4. For which integers a and b does neither equality hold?
Hint: DERIVE commands such as the one below quickly generate many examples.
VECTOR (VECTOR( [a, b, IF ( GCD(a, b) = GCD(a + b, a - b) ) ],
a, 1, 10), b, 1, 6)
Click here to view the Solutions page for these exercises.
Download