tik-tok's blog

By tik-tok, history, 5 years ago, In English

Hi everyone,

(131015-1) / (13-1)

I want to calculate the previous value modulo 36 in an efficient way, how can I do that?

  • Vote: I like it
  • -9
  • Vote: I do not like it

»
5 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Can you provide a link to the problem?

  • »
    »
    5 years ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    Sorry it is not a CP problem, I know how to calculate the inverse modulo but in this case the denominator (13-1 = 12) and the modulo 36 are not coprime, so I am not sure how to do the calculation in a fast way and without an overflow happening

»
5 years ago, hide # |
 
Vote: I like it +1 Vote: I do not like it
  • »
    »
    5 years ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    Thanks for the reply, but my problem is in the division by 12, will this solve my problem?

»
5 years ago, hide # |
 
Vote: I like it +10 Vote: I do not like it

$$$(13^{10^{15}}-1) = (13-1)(13^{10^{15}-1}+13^{10^{15}-2}+...+13^1+1)$$$

$$$(13^{10^{15}}-1)/(13-1)= (13^{10^{15}-1}+13^{10^{15}-2}+...+13^1+1)$$$

$$$13^n \mod 36 = \begin{cases} 1(n \equiv 0 \mod 3) \\ 13(n \equiv 1 \mod 3) \\ 25(n \equiv 2 \mod 3) \end{cases}$$$

Then, you can just sum up this.