0% found this document useful (0 votes)
13 views

Programming Challenges 16-16

This document covers topics in combinatorics and number theory including basic counting techniques, binomial coefficients, prime numbers, divisibility, modular arithmetic, and congruences. It also includes example problems for each topic.

Uploaded by

Sandeep Singh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Programming Challenges 16-16

This document covers topics in combinatorics and number theory including basic counting techniques, binomial coefficients, prime numbers, divisibility, modular arithmetic, and congruences. It also includes example problems for each topic.

Uploaded by

Sandeep Singh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Contents xv

5.11 Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128

6 Combinatorics 129
6.1 Basic Counting Techniques . . . . . . . . . . . . . . . . . . . . . . . . 129
6.2 Recurrence Relations . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
6.3 Binomial Coefficients . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
6.4 Other Counting Sequences . . . . . . . . . . . . . . . . . . . . . . . . 133
6.5 Recursion and Induction . . . . . . . . . . . . . . . . . . . . . . . . . 135
6.6 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
6.6.1 How Many Fibs? . . . . . . . . . . . . . . . . . . . . . . . . . 137
6.6.2 How Many Pieces of Land? . . . . . . . . . . . . . . . . . . . 138
6.6.3 Counting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
6.6.4 Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
6.6.5 Complete Tree Labeling . . . . . . . . . . . . . . . . . . . . . 141
6.6.6 The Priest Mathematician . . . . . . . . . . . . . . . . . . . . 142
6.6.7 Self-describing Sequence . . . . . . . . . . . . . . . . . . . . . 144
6.6.8 Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
6.7 Hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
6.8 Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146

7 Number Theory 147


7.1 Prime Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
7.1.1 Finding Primes . . . . . . . . . . . . . . . . . . . . . . . . . . 148
7.1.2 Counting Primes . . . . . . . . . . . . . . . . . . . . . . . . . 149
7.2 Divisibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
7.2.1 Greatest Common Divisor . . . . . . . . . . . . . . . . . . . . 150
7.2.2 Least Common Multiple . . . . . . . . . . . . . . . . . . . . . 151
7.3 Modular Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
7.4 Congruences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
7.4.1 Operations on Congruences . . . . . . . . . . . . . . . . . . . 154
7.4.2 Solving Linear Congruences . . . . . . . . . . . . . . . . . . . 155
7.4.3 Diophantine Equations . . . . . . . . . . . . . . . . . . . . . . 155
7.5 Number Theoretic Libraries . . . . . . . . . . . . . . . . . . . . . . . 156
7.6 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
7.6.1 Light, More Light . . . . . . . . . . . . . . . . . . . . . . . . . 157
7.6.2 Carmichael Numbers . . . . . . . . . . . . . . . . . . . . . . . 158
7.6.3 Euclid Problem . . . . . . . . . . . . . . . . . . . . . . . . . . 159
7.6.4 Factovisors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
7.6.5 Summation of Four Primes . . . . . . . . . . . . . . . . . . . . 161
7.6.6 Smith Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . 162
7.6.7 Marbles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
7.6.8 Repackaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
7.7 Hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
7.8 Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166

You might also like