I was reading through the discussions in this thread a few days ago, and it sort of inspired me to try programming for the first time. So I downloaded Python (with original intention to run NHigh on it, but used it as a programming tool as well) and looked up a few of those tutorials on the Internet.
Now I had just created this program using Python to find the smallest nontrivial factor of a positive integer, and here it is:
Code: Select all
def bleurgh(n):
for x in range (2, n^(1/2)):
if n % x = 0:
print n, "=", x, "*", n/x
else:
print n, "BLEURGH"
and I tested it first for a few small numbers and it worked fine, giving instantaneous responses. So i decided to take it up a level and get it to factorise this nine-digit composite number:
and what followed was the most hideous scene that I have ever experienced on my computer since actively watching the destruction of my NReality highscore *0ths by Unreality back in April.
Firstly, I pressed Enter, and - nothing happened initially. It later transpired that the computer seemed to be calculating bleurgh(157519381) and taking an unusually long time. However, I soon realised that the computer's hard drive was making the most grotesque noises that I had ever heard, and it had slowed the computer down right to a snail's pace such that even the TheRealN Forums homepage was taking a minute to refresh itself and kept giving the "Not Responding" message temporarily whenever I clicked on anything. I tried to get Python to close to kill the program off, but that itself took three minutes and a failed attempt to load Task Manager, and the noises did not stop. Finally Task Manager opened, showing that there were no other programs running than those which I had intended to run, so I closed it again and opened Python again in the hope that things would soon get back to normal.
That was certainly not the case. The unbearable noises continued to invade my ears, and the computer's speed was not showing any signs of improving. Finally Python opened. I pasted the program back onto the screen and tested it for some more small numbers, for which it did work. But suddenly a window appeared on the screen which was nothing like I had ever seen before in the five years of my using the computer. It stated that "Virtual Memory is too low" followed by some other ridiculous rubbish. Python closed itself. I was so alarmed that I shut down the computer completely.
At that point I was not sure whether such a bizarre problem was a cause of Python or of something else. So I turned the computer on again, loaded up Python, put the program into it, tested it for some small numbers, and typed in bleurgh(157519381) again. The same thing happened with the unresponsiveness and the grinding noises emanating from the hard drive. I shut down the computer before the situation got any worse.
I have absolutely no idea what went wrong there. I had previously tested a similar program to find the smallest nontrivial prime factor of eleven-digit numbers and it worked very smoothly indeed. Is it the program itself, or is it something to do with the way that Python is handled by my computer? How do I solve it?