如何计算表达式

时间:2017-02-02 07:24:32

标签: math modular-arithmetic

给出等式 - > (指数+旋转)%腐= F;如果我知道f,旋转,腐烂的值 什么是计算指数的公式。我在数学方面不是很好,但我想知道在我的编程中计算索引。

1 个答案:

答案 0 :(得分:0)

  

(指数+旋转)%rot = f

装置

index + rotation = rot*k + f, k is an integer (.., -2, -1, 0, 1, 2,..)

因此

index = rot*k + f - rotation, k: integer

如果您想index > 0,请务必选择k > (rotation - f) / rot