Interesting Question on Co-primes

Правка en1, от darth_chef, 2020-08-22 09:17:30

I found this question somewhere online, which went as follows: For each integer x in a given range [L, R], find the count of integers in the given range that are co-prime with x. Constraints: 1 <= L <= R <= 1e5

A brute force solution would fail the time limit, does anyone have an optimal solution?

Теги number theory, gcd, coprime

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский darth_chef 2020-08-22 09:25:05 156
en1 Английский darth_chef 2020-08-22 09:17:30 336 Initial revision (published)