(A+xB)/C = y

An algorithm to find x, when A, B, C and y are integers.

YAML 來源 問題

Is there an already is such an algorithm out there, to generically and efficiently find a place where an integer summation series such as A+B+B+B+... becomes exactly divisible by some other integer C.


投票 (可選) (別通知) (可選)

我認爲,Halfbakery 的 [notexactly] 有一點:

“除非我誤解了問題陳述,否則這似乎是最小公倍數問題的一個微不足道的變體,可以通過幾種算法 [鏈接] 來解決。(A xB)/C = y 在我看來等同於 y = LCM(A - C, B)。”


I think, [notexactly] from Halfbakery has a point:

"Unless I'm misunderstanding the problem statement, this seems like a trivial variant of the least common multiple problem, which can be solved by several algorithms [link]. (A+xB)/C = y seems to me to be equivalent to y = LCM(A - C, B)."

Perhaps the solution is simple, but I had not yet verified this (TBD later).