##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
Euler totient, CRT, prime factorization, and modular arithmetic through 10 problems.
Mathematical foundations for CP
What you'll learn
CF 1295D - count values with same GCD
Reduce to totient calculation
Totient via prime factorization
Square root factorization
CF 687B - determine value from remainders
Can't enumerate all possible x
Check prime power coverage
Check prime power divisibility
Factorization plus linear scan
CF 1033D - factor product of semiprimes
Numbers are too large to factor directly
GCD to find shared primes
GCD-based factorization
Quadratic in input size
CF 1748D - find x with OR divisibility
Use LCM for bit construction
Construct x from LCM
Constant time construction
CF 1761D - count pairs with k carries
Exponential pair count
Carry sequence structure
Count carry sequences
Direct formula with combinatorics
Linear precomputation
CF 1244C - find win/draw/loss counts
Small iteration on draws
Iterate draws up to w
Linear in point values
CF 1493D - dynamic GCD with updates
Recomputing GCD is too slow
Track min exponent per prime
Multiset per prime
Per-prime multiset operations
CF 1884D - count coprime pairs not dividing any element
Quadratic pair counting
Exact GCD via inclusion-exclusion
Iterate by GCD value with validity check
Count by GCD with exclusion
Harmonic sum complexity
Test your understanding
What you've learned