Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,32 @@
|
|||
# -*- ObjectIcon -*-
|
||||
#
|
||||
# This program is close to being an exact copy of the Icon.
|
||||
#
|
||||
|
||||
import io # <-- Object Icon requires this for I/O.
|
||||
|
||||
procedure main()
|
||||
local a, b # <-- Object Icon forces you to declare your variables.
|
||||
|
||||
a := 2988348162058574136915891421498819466320163312926952423791023078876139
|
||||
b := 2351399303373464486466122544523690094744975233415544072992656881240319
|
||||
|
||||
# You could leave out the "io." in the call to "write" below,
|
||||
# because there is some "compatibility with regular Icon" support in
|
||||
# the io package.
|
||||
io.write("last 40 digits = ", mod_power(a,b,(10^40)))
|
||||
end
|
||||
|
||||
procedure mod_power(base, exponent, modulus)
|
||||
local result
|
||||
|
||||
result := 1
|
||||
while exponent > 0 do
|
||||
{
|
||||
if exponent % 2 = 1 then
|
||||
result := (result * base) % modulus
|
||||
exponent /:= 2
|
||||
base := base ^ 2 % modulus
|
||||
}
|
||||
return result
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue