mod(c(-5:5), 5)
mod(c(-5:5), -5)
mod(0, 1) #=> 0
mod(1, 0) #=> 1
modq(5, 66, 5) # 0 (Bernoulli 10)
modq(5, 66, 7) # 4
modq(5, 66, 13) # 5
modq(5, 66, 25) # 5
modq(5, 66, 35) # 25
modq(-1, 30, 7) # 3 (Bernoulli 8)
modq( 1, -30, 7) # 3
# Warning messages:
# modq(5, 66, 77) : Arguments 'b' and 'm' must be coprime.
# Error messages
# modq(5, 66, 1) : Argument 'm' mustbe a natural number > 1.
# modq(5, 66, 1.5) : All arguments of 'modq' must be integers.
# modq(5, 66, c(5, 7)) : Function 'modq' is *not* vectorized.
Run the code above in your browser using DataLab