Making a very large Java array

后端 未结 15 2184
鱼传尺愫
鱼传尺愫 2020-12-03 08:57

I\'m trying to find a counterexample to the Pólya Conjecture which will be somewhere in the 900 millions. I\'m using a very efficient algorithm that doesn\'t even require an

15条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-03 09:11

    You can try splitting it up into multiple arrays.

    for(int x = 0; x <= 1000000; x++){
        myFirstList.add(x);
    }
    for(int x = 1000001; x <= 2000000; x++){
        mySecondList.add(x);
    }
    

    then iterate over them.

    for(int x: myFirstList){
        for(int y: myFirstList){
            //Remove multiples
        }
    }
    //repeat for second list
    

提交回复
热议问题