View/Edit #111:exp_mod

Switch to edit mode.

Name(s): exp_mod
1:  ":exp_nod(a, m, m) => a^n mod m"
2:  {a, n, m} = args
3:  if (n == 0)
4:    return 1
5:  elseif (n == 1)
6:    return a % m
7:  else
8:    return this:exp_mod(a, n / 2, m) ^ 2 % m * (n % 2 ? a % m | 1) % m
9:  endif
10: "Last modified by manta (#7165) on Thu Feb  3 16:13:01 2000 MST."
11: "This verb previously owned by manta (#7165), and chowned to $slacker upon dewizarding (Sat Aug 17 14:50:05 2002 MDT)."
12: "Last modified by Dax (#789) on Sat Aug 17 14:50:05 2002 MDT."

Verb arguments: this none this
Verb perms: Readable eXecutable NOT-Debug
Verb owned by: Slacker (#55)

You are not logged in.

[home | help | who | search | setup | code]