shh.gl4
Class ZModNData

Object
  extended byZModNData

public class ZModNData
extends Object

A small database of facts about the ring Z/NZ.

Author:
Mark McConnell

Field Summary
 int cardP3
          The number of points in P3(Z/NZ).
 int N
           
 
Constructor Summary
ZModNData(int N)
          Constructor.
 
Method Summary
 int getInverse(int i)
          Returns the inverse of i modulo N, or 0 if i is not a unit mod N.
 ArrayList getUnits()
          Returns a list of the units mod N, as Integers.
static void main(String[] args)
          Prints out all the data.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

N

public final int N

cardP3

public final int cardP3
The number of points in P3(Z/NZ). When N is prime, this is the usual projective three-space over the finite field. See PPT for what it is in general.

Constructor Detail

ZModNData

public ZModNData(int N)
Constructor.

Throws:
IllegalArgumentException - If N ≤ 1.
ArithmeticException - If N is so big that cardP3 would not fit in an int.
Method Detail

getUnits

public ArrayList getUnits()
Returns a list of the units mod N, as Integers. The values are between 1 and N-1 and sorted by <. A fresh list is returned every time.


getInverse

public int getInverse(int i)
Returns the inverse of i modulo N, or 0 if i is not a unit mod N. Expects 0 ≤ i < N.


main

public static void main(String[] args)
Prints out all the data. Give it one argument, N.