Skip to content

Explorations into the methods and exercises of "Concrete Mathematics: A Foundation for Computer Science" by Graham, Knuth and Patashnik

License

Notifications You must be signed in to change notification settings

tzaffi/concrete_math

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

concrete_math

Explorations into the methods and exercises of "Concrete Mathematics: A Foundation for Computer Science" by Graham, Knuth and Patashnik

Chapter 1: Recurrent Problems

I've implemented the following algorithms in the first chapter:

  • The solution to the "textbook" Josephus problem
  • The solution to the binary generalization of the Josephus problem
  • The solution to the generalized Josephus problem that can handle any cases
  • A naive implementation of the REAL Josephus problem (where you skip every TWO warriors, instead of every other). I don't know a closed form solution.
  • A small class util.zio that allows printing to a string instead of to STDOUT by enclosing in a context manager using with
  • Code to convert a number to a sequence for a given radix and vice versa. This generalizes Python's int() constructor which can handle radixes of 2 through 36.

About

Explorations into the methods and exercises of "Concrete Mathematics: A Foundation for Computer Science" by Graham, Knuth and Patashnik

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages