Skip to content

A small script to help visualize the euclidean algorithm

Notifications You must be signed in to change notification settings

vinomartins/gcdvis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

gcdvis

A small script to help visualize the euclidean algorithm for computing the greatest common divisor by tilling a rectangle with the biggest possible squares. The gcd will be the side of the smallest square. Check a worked example.

How to run it

You'll need python and pdflatex. Just type

python gen.py <a> <b>

in the command line replacing <a> and <b> positive integers. The script will then generate a file named final.tex and run pdflatex on it. If you want the tikz code to use elsewhere just copy from the .tex file. The additional argument beamer will generate a beamer presentation with pauses so that the squares appear one at a time.

Example

Running

python gen.py 21 13

will generate a pdf with the following image:

final-1

While

python gen.py 21 8 beamer

generate a beamer presentation with the following content final_beamer-1 final_beamer-2 final_beamer-3 final_beamer-4 final_beamer-5 final_beamer-6 final_beamer-7 final_beamer-8 final_beamer-9

About

A small script to help visualize the euclidean algorithm

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published