Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 01e9f74258
Fetching contributors…

Cannot retrieve contributors at this time

12 lines (9 sloc) 0.325 kb
type ModInt{N}
k::Int
ModInt(k) = new(k % N)
end
+{N}(a::ModInt{N}, b::ModInt{N}) = ModInt{N}(a.k+b.k)
*{N}(a::ModInt{N}, b::ModInt{N}) = ModInt{N}(a.k*b.k)
convert{N}(::Type{ModInt{N}}, i::Integer) = ModInt{N}(i)
show{n}(io, k::ModInt{n}) = println(io, "$(k.k) mod $n")
showcompact(io, k::ModInt) = print(io, k.k)
Jump to Line
Something went wrong with that request. Please try again.