Mod arithmetic: What day will it be in x hours?

52 Views Asked by At

What day will it be in 48 hours? $$\frac{48}{24}=\frac{6}{3}(mod7)≡6∗3^{−1}(mod7)≡6∗5(mod7)≡2(mod7)$$ is the right answer. But the same technique does not work for 25 hours: $$\frac{25}{24}≡\frac{25}{24}(mod7)≡{25}*{24^{-1}}(mod7)≡25∗5(mod7)≡6(mod7)$$

Why am I unable to get $1(mod7)$?

2

There are 2 best solutions below

0
On

The difference is that $48$ hours is exactly $2$ days, so you can add $2$ to today's day number $\bmod 7$ and get the right answer. $25$ is not a multiple of $24$, it is $1$ day plus $1$ hour. Unless it is after $11$ PM or $2300$ the new day number is $1$ more than today's. If it is after $2300$ you have a carry and the new day is $2$ more than today's.

0
On

To know what day it will be in $n$ hours depends on what time it is. A formula that works might go as follows: $$\frac{n - (n \mod 24)}{24} \mod 7 \\ + 1 \text{ if } t + (n \mod 24) >= 24, \\ + 0 \text{ if } t + (n \mod 24) < 24 $$ where $t$ is time in 24 hour time put in integer form (i.e. 12pm is 12, 4pm is 16, 12am is 0)