Let S{a, b, c, d} be a set of four positive integers. If pairs
of distinct elements of S are added, the following six sums are
obtained:5,10, 11,13,14,19. Determine the values of a, b, c, and d.
(There are two possibilities. )
Three positive integers (a, b, c) with a<b<c are called a
Pythagorean triple if the sum of the square of a and the square of
b is equal to the square of c. Write a program that prints all
Pythagorean triples (one in a line) with a, b, and c all smaller
than 1000, as well the total number of such triples in the end.
Arrays are not allowed to appear in your code. Hint: user nested
loops (Can you...
Let A[1..n] be an array of distinct positive integers, and let t
be a positive integer.
(a) Assuming that A is sorted, show that in O(n) time it can be
decided if A contains two distinct elements x and y such that x + y
= t.
(b) Use part (a) to show that the following problem, re- ferred to
as the 3-Sum problem, can be solved in O(n2) time:
3-Sum
Given an array A[1..n] of distinct positive integers, and...
8.Let a and b be integers and d a positive
integer.
(a) Prove that if d divides a and d divides b, then d divides both
a + b and a − b.
(b) Is the converse of the above true? If so, prove it. If not,
give a specific example of a, b, d showing
that the converse is false.
9. Let a, b, c, m, n be integers. Prove that if a divides each of b
and c,...
Let a and b be positive integers, and let d be their greatest
common divisor. Prove that there are infinitely many integers x and
y such that ax+by = d. Next, given one particular solution x0 and
y0 of this equation, show how to find all the solutions.
(a) Can the sum of 12345 odd pos-
itive integers be 12345678 ? Prove or disprove.
(b) Prove that for every possible re-arrangement (b1, b2, . . . ,
b999) of the
numbers (1, 2, . . . , 999), the product
(b1 − 1)(b2 − 2)(b3 − 3) · . . . · (b999 − 999) is even.
Prove by contraposition and again by contradiction:
For all integers a,b, and c, if a divides b and a does not
divide c then a does not divide b + c
Elaboration with definitions / properties used would be
appreciated!
Thanks in advance!!