csci 246 – class 2mdale/courses/csci246/slides/csci 246 - cla… · csci 246 –class 7 proofs...

15
CSCI 246 – Class 7 PROOFS Plan for today: - Quiz - Normal review of video lesson (Euclidean Algo) - Quiz question over video - Review - Homework - Python IDE Demo - Break – Download preferred IDE - Python

Upload: others

Post on 08-May-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CSCI 246 – Class 2mdale/courses/CSCI246/slides/CSCI 246 - Cla… · CSCI 246 –Class 7 PROOFS Plan for today:-Quiz -Normal review of video lesson (Euclidean Algo)-Quiz question

CSCI 246 – Class 7PROOFS

Plan for today:

- Quiz

- Normal review of video lesson (Euclidean Algo)

- Quiz question over video

- Review

- Homework

- Python IDE Demo

- Break – Download preferred IDE

- Python

Page 2: CSCI 246 – Class 2mdale/courses/CSCI246/slides/CSCI 246 - Cla… · CSCI 246 –Class 7 PROOFS Plan for today:-Quiz -Normal review of video lesson (Euclidean Algo)-Quiz question

Quiz Questions

Lecture 13:

Remember that Euclidean Algorithm is:

Function gcd(a,b)

If(a<b) return gcd (b,a)

If (b=0) return a

Else return gcd(b, a mod b)

Step through the algorithm gcd of gcd(57, 9):

Page 3: CSCI 246 – Class 2mdale/courses/CSCI246/slides/CSCI 246 - Cla… · CSCI 246 –Class 7 PROOFS Plan for today:-Quiz -Normal review of video lesson (Euclidean Algo)-Quiz question

Notes

Have a good weekend

Page 4: CSCI 246 – Class 2mdale/courses/CSCI246/slides/CSCI 246 - Cla… · CSCI 246 –Class 7 PROOFS Plan for today:-Quiz -Normal review of video lesson (Euclidean Algo)-Quiz question

Lesson 13

Lemma:

Let a>b

By the Quotient – Remainder Theoerm: a=q*b+r

=> r = a mod b

Then GCD (a,b) = GCD(b,r)

Page 5: CSCI 246 – Class 2mdale/courses/CSCI246/slides/CSCI 246 - Cla… · CSCI 246 –Class 7 PROOFS Plan for today:-Quiz -Normal review of video lesson (Euclidean Algo)-Quiz question

Lesson 13

Lemma:

Let a>b

By the Quotient – Remainder Theoerm: a=q*b+r

=> r = a mod b

Then GCD (a,b) = GCD(b,r)

Page 6: CSCI 246 – Class 2mdale/courses/CSCI246/slides/CSCI 246 - Cla… · CSCI 246 –Class 7 PROOFS Plan for today:-Quiz -Normal review of video lesson (Euclidean Algo)-Quiz question

Lesson 13

Proof:

1) let d|a and d|b

Page 7: CSCI 246 – Class 2mdale/courses/CSCI246/slides/CSCI 246 - Cla… · CSCI 246 –Class 7 PROOFS Plan for today:-Quiz -Normal review of video lesson (Euclidean Algo)-Quiz question

Lesson 13

Proof:

1) let d|a and d|b

a=u*d b=v*d

Page 8: CSCI 246 – Class 2mdale/courses/CSCI246/slides/CSCI 246 - Cla… · CSCI 246 –Class 7 PROOFS Plan for today:-Quiz -Normal review of video lesson (Euclidean Algo)-Quiz question

Lesson 13

Proof:

1) let d|a and d|b

a=u*d b=v*d

r = a-q*b = (ud)-q*(v*d) =(u-qv)d

Page 9: CSCI 246 – Class 2mdale/courses/CSCI246/slides/CSCI 246 - Cla… · CSCI 246 –Class 7 PROOFS Plan for today:-Quiz -Normal review of video lesson (Euclidean Algo)-Quiz question

Lesson 13

Proof:

1) let d|a and d|b

a=u*d b=v*d

r = a-q*b = (ud)-q*(v*d) =(u-qv)d

=> d|r

Page 10: CSCI 246 – Class 2mdale/courses/CSCI246/slides/CSCI 246 - Cla… · CSCI 246 –Class 7 PROOFS Plan for today:-Quiz -Normal review of video lesson (Euclidean Algo)-Quiz question

Lesson 13

Euclid or Euclidean's Algorithm

Function gcd(a,b)

If (a<b) return gcd(b,a)

If (b=0) return a

Else return gcd(b, a mod b)

Page 11: CSCI 246 – Class 2mdale/courses/CSCI246/slides/CSCI 246 - Cla… · CSCI 246 –Class 7 PROOFS Plan for today:-Quiz -Normal review of video lesson (Euclidean Algo)-Quiz question

Homework (Group)

Walk through Euclidean's Algorithm for the following:

1. gcd(24, 60)

2. gcd(24, 105)

3. gcd(60, 7)

Page 12: CSCI 246 – Class 2mdale/courses/CSCI246/slides/CSCI 246 - Cla… · CSCI 246 –Class 7 PROOFS Plan for today:-Quiz -Normal review of video lesson (Euclidean Algo)-Quiz question

Homework (Individual)

Walk through Euclidean's Algorithm for the following:

1. gcd(4, 14)

2. gcd(14, 4)

3. gcd(14, 89)

Page 13: CSCI 246 – Class 2mdale/courses/CSCI246/slides/CSCI 246 - Cla… · CSCI 246 –Class 7 PROOFS Plan for today:-Quiz -Normal review of video lesson (Euclidean Algo)-Quiz question

Demo

Python IDEs

Visual Studio Express with Python Plug-in

Pycharm

Page 14: CSCI 246 – Class 2mdale/courses/CSCI246/slides/CSCI 246 - Cla… · CSCI 246 –Class 7 PROOFS Plan for today:-Quiz -Normal review of video lesson (Euclidean Algo)-Quiz question

Break

Python IDEs

Visual Studio Express with Python Plug-in

https://www.visualstudio.com/en-us/downloads/visual-studio-2015-downloads-vs.aspx

https://pytools.codeplex.com/

Pycharm

https://www.jetbrains.com/pycharm/

Page 15: CSCI 246 – Class 2mdale/courses/CSCI246/slides/CSCI 246 - Cla… · CSCI 246 –Class 7 PROOFS Plan for today:-Quiz -Normal review of video lesson (Euclidean Algo)-Quiz question

Awesome resources

First Learning

Learn Python the Hard way: http://learnpythonthehardway.org/book/

Check IO Game: http://www.checkio.org/

References:

Hitchhiker’s Guide to Python: http://docs.python-guide.org/en/latest/

Python.org: https://docs.python.org/3/