Package de.tilman_neumann.jml.base
Class BigIntTriangle
- java.lang.Object
-
- de.tilman_neumann.jml.base.BigIntTriangle
-
- Direct Known Subclasses:
EgyptianFractionsTriangle
public class BigIntTriangle extends Object
A triangle of integers.- Author:
- Tilman Neumann
-
-
Constructor Summary
Constructors Constructor Description BigIntTriangle()Create a triangle without data.BigIntTriangle(int n, BigInteger init)Creates an initialized number triangle with n rows.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRow(ArrayList<BigInteger> row)BigIntegerget(int n, int k)Returns the entry T[n,k], with T[1,1] being the very first element.ArrayList<BigInteger>getRow(int n)return n.th row, where the first row has index 1.BigIntegergetRowSum(int n)Returns the sum over all entries of the n.th row, where the first row has index 1.ArrayList<BigInteger>getRowSums()voidset(int n, int k, BigInteger value)Sets the value T[n,k].ArrayList<BigInteger>toList()StringtoString()
-
-
-
Constructor Detail
-
BigIntTriangle
public BigIntTriangle()
Create a triangle without data. Rows may be added with the addRow() method.
-
BigIntTriangle
public BigIntTriangle(int n, BigInteger init)Creates an initialized number triangle with n rows.- Parameters:
n-init- The value with which the triangle entries are initialized.
-
-
Method Detail
-
get
public BigInteger get(int n, int k)
Returns the entry T[n,k], with T[1,1] being the very first element.- Parameters:
n-k-- Returns:
- T[n,k]
-
set
public void set(int n, int k, BigInteger value)Sets the value T[n,k].- Parameters:
n-k-value-
-
addRow
public void addRow(ArrayList<BigInteger> row)
-
getRow
public ArrayList<BigInteger> getRow(int n)
return n.th row, where the first row has index 1.- Parameters:
n-- Returns:
- n.th row
-
getRowSum
public BigInteger getRowSum(int n)
Returns the sum over all entries of the n.th row, where the first row has index 1.- Parameters:
n-- Returns:
- the sum over all entries of the n.th row
-
getRowSums
public ArrayList<BigInteger> getRowSums()
- Returns:
- List of row sums of this triangle.
-
toList
public ArrayList<BigInteger> toList()
- Returns:
- This triangle converted into a list read by rows. Better suited for OEIS lookups.
-
-