Skip to content

Instantly share code, notes, and snippets.

@rohitvvv
Created February 20, 2017 01:40
Show Gist options
  • Save rohitvvv/1a16a66c9f1df6a3c4690d3097c1c7fe to your computer and use it in GitHub Desktop.
Save rohitvvv/1a16a66c9f1df6a3c4690d3097c1c7fe to your computer and use it in GitHub Desktop.
package com.company;
//import java.util.ArrayList;
//import java.util.List;
//class GenerateRandom{
// int range;
// List<Integer> randomNumbers;
// GenerateRandom(int rangeMin,int rangeMax){
// randomNumbers= new ArrayList<>();
// for(int i=0;i<200;i++){
// randomNumbers.add((int)(Math.random()*(rangeMax-rangeMin)));
// }
// }
//}
class OddFactorsSum{
int []a={2599,2435, 902,2482, 97,1217,2099, 620,1746,2575,
2870,1003, 46,1488,1667,1381,2974, 127,2283, 735,
1427,1011, 419,1322,1500, 857, 343, 306,1765,2452,
2198,1075, 466,2888, 701,2570,2988, 695,1341,1053,
1004,1115,1617,1640,2226, 684, 383, 716,1983,2610,
964,2946, 559,1125,2471, 70, 652,1942,2487,2928,
294,1339, 254,2385,1121,1066, 447,2703,1081,2291,
1742,2851,2391, 209,1529,1829,2956, 622,2433,2657,
1364, 913,2665, 14,1133,2188,2673,1729,2049, 164,
145,2374, 102,1439,2048,2101,1906, 260,1154, 601,
388,2639,2303, 652,2021,2850, 643,2135,2019, 761,
53,1684,1576,1309,1131, 215, 540,2566,2292,2585,
801,1350, 868, 389, 140,1181,2478,2546,1362,1576,
2457, 869, 224,1210,2683,1056,2882,1349,1862,1801,
2500, 171, 93,1677,1049,2179,2391,2343,2406, 803,
844,1317,2501,2529, 87,2120,1445, 540,1987,2968,
455,1710,1631, 446,2765,1184, 64, 671,2747,2287,
1665,2383,1049,1588,1571, 155, 779,1167, 156,2534,
2539,2869,2328,1409,2517,2270, 190,2131, 778,2465,
2493,2146,1547, 475,2354,1805,2370,2069,1758, 902};
int findOddFactorSum(){
int sum=0;
for(int i=0;i<a.length;i++){
if(a[i]>0)
sum++;
for(int j=3;j<=a[i];j=j+2){
if(a[i]%j==0){
sum=sum+j;
}
}
}
return sum;
}
}
public class Main {
public static void main(String[] args) {
OddFactorsSum obj = new OddFactorsSum();
System.out.println(obj.findOddFactorSum());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment