GCDs

From programming_contest
Jump to navigation Jump to search

realization: only a small total count of GCDs. moreso, any range that spans coprime numbers will be 1. or more generally, all numbers in that range must be divisible by the GCD, and no higher number.

So go through each number, track the earliest seen number which is divisible by each possible GCD (max 100). O(100*100k)