add nilpotent
This commit is contained in:
parent
4fc2ee088c
commit
7b0bd3d83c
37
Main.java
37
Main.java
@ -270,6 +270,43 @@ public class Main {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static LinkedList<LinkedList<Integer>> nilpotent(LinkedList<LinkedList<Integer>> elements,LinkedList<Integer> expect, int mod) {
|
||||
|
||||
LinkedList<LinkedList<Integer>> result = new LinkedList<LinkedList<Integer>>();
|
||||
LinkedList<Integer> temp = new LinkedList<Integer>();
|
||||
|
||||
LinkedList<Integer> tempPow = new LinkedList<Integer>();
|
||||
|
||||
result.add(elements.get(0));
|
||||
|
||||
for(int i=1; i<elements.size();i++) {
|
||||
|
||||
temp = elements.get(i);
|
||||
|
||||
for(int j=2; j<mod; j++)
|
||||
|
||||
tempPow = temp;
|
||||
|
||||
temp = polynomialsMultiplication(tempPow,temp);
|
||||
|
||||
// mod
|
||||
temp = modPolynomial(mod,temp);
|
||||
|
||||
if(temp.size() >= expect.size()) {
|
||||
temp = dividePolynomials(temp, expect, mod);
|
||||
}
|
||||
else continue;
|
||||
|
||||
if(temp.size() == 1 && temp.getFirst() == 0) {
|
||||
result.add(elements.get(i));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user