factors method
Implementation
List<int> factors(){
int maxIterations = this ~/ 2;
//All numbers have 1 as a factor
List<int> foundFactors = [1];
for(int i = 2; i <= maxIterations; i++){
if(this % i == 0){
foundFactors.add(i);
}
}
//Add itself as a factor
foundFactors.add(this);
return foundFactors;
}