0% found this document useful (0 votes)
4 views8 pages

Recursive Examples

Uploaded by

serhatkeremtufan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views8 pages

Recursive Examples

Uploaded by

serhatkeremtufan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Examples

Example 4.34
• Find the greatest common divisor of 250 and 111, and express the result
as a linear combination of these integers.

• gcd(250, 111) = 1
• The linear combination: (250x + 111y = 1)
1 = 28 – 1 x (111 – 3 x 28)
= 4 x 28 – 1 x 111
= 4 x (250 – 2 x 111) – 1 x 111
= 4 x 250 – 9 x 111
Example – Java program
• Please explain the java codes.
Example - Diophantine equation

We seek integers x, y ≥ 0,
where 6x + 10y = 104, or 3x + 5y = 52.

5 = 1x3 + 2 1 = 3 – 1x(5 – 1 x3)


3 = 1*2 + 1 1 = 3x2 + 5x(-1)
2 = 1x2 52 = 3x104 + 5x(-52)
= 3(104-5k) + 5(-52 + 3k), k ∈ Z.
x0 = 104, y0 = -52
Example(cont.) - Diophantine equation

Since 0 ≤ x = 104 – 5k and 0 ≤ y = –52 + 3k, we must have


(52/3) ≤ k ≤ (104/5). So k = 18, 19, 20.
a) (k = 18): x = 14, y = 2
b) (k = 19): x = 9, y = 5
c) (k = 20): x = 4, y =8
Example

6 8 10 12 14

+1
Example: Section 4.1
Example: Sudoku

You might also like