altrko's blog

By altrko, history, 2 months ago, In English

Now that i think about it, i wonder same in life as well.

1967B1 - Reverse Card (Easy Version)

if a+b ⋮ b*gcd(a,b) then a ⋮ b*gcd(a,b) so gcd(a,b) is b therefor a⋮b^2

p.s i didn't get the editorial so someone telling me it would be nice as well

  • Vote: I like it
  • +2
  • Vote: I do not like it

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by altrko (previous revision, new revision, compare).

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

By definition, a ⋮ gcd(a,b) and b ⋮ gcd(a,b), so if a ⋮ b*gcd(a,b) its not necessary that a ⋮ b. I think I understood the editorial, when did it stop making sense for you?

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

ok,so we know that (a+b)%(b*gcd(a,b))=0.now it only satisfies when a=b*y.since b*gcd(a,b) divides a+b think of it in this way if b a!=b*d,then (a+b)%b!=0,so the (a+b)%(b*gcd(a,b))!=0,so we can never get a pair when a%b!=0,thus a%b=0,now we can replace (a+b) as,b*(y+1),now talking about b*gcd(a,b).we can write it has b*gcd(b*y,b),now gcd(b*y,b)=b,thus we can say that b*gcd(a,b)=b*b,now b*(y+1)=b*b*t.we need to find t,b cancels from both side and we get (y+1)=b*t,now we need the maximum value of y on lhs it is nothing but ⌊n/b⌋,thus we get (⌊n/b⌋+1)=b*t,t=(⌊n/b⌋+1)/b.now run loop from 1 to m and keep adding your t value.