如何完成这项任务?

I run 64-bit Windows 8.1 Pro with Git Bash installed. I have a 703 MB text file. In it, there's 18,949 integers, each on its own line. All of the integers are of varying lengths - the largest one is 83,639 digits long! Here's what I need to be able to do:

  1. For each of the lines in the text file, check if the integer has at least one perfect divisor between 2 and 1,000,000.

  2. If a perfect divisor is found, stop checking for another and skip to the next integer on the next line.

  3. If a perfect divisor is not found, take that integer and save it to a new text file.

  4. Do the same for the next lines.

I have some background in Java but it would seem the task I outlined cannot be accomplished with the language, seeing as how the lines are of varying lengths. See one of the answers from here. I figured it might be possible in Bash or something of the sort. After all, it is a Turin-complete language.

评论