Well, first off I'd like to congratulate all the students here for school having ended. A bit late, I know, but I'm in Korea. That's my excuse.
Now, I have this summer assignment due for my upcoming freshmen year, and this factoring section is killing me. The problems are basic but super long and tedious, and us programmers are lazy. The problems are like this:
I was taught to find the products of a and c and find the factor pair which added up to b. Then you would do this:
I guess most of you know this. Anyways, it takes a million years to find that factor pair when the numbers get huge and ugly. So I wanted a program that would do it for me. I had my draft input the product of a and c and then b. I tried using a For( loop but the List issues are what make me stuck. Here's the code (so far)
PROGRAM:FACTOR :ClrList L₁,L₂ :ClrHome :Input "AC: ",X :Input "B: ",Y :For(A,1,X :X/A→B :If fPart(B)=1 :Then
I don't know what to do after that Then statement. I want to place all the pairs which are potential in a list of some sort, but I don't know how to add variables into a list (I mean that any number of variables could be placed into the list, ranging from 1 to infinity) and I don't know how to extract a certain pair from a list. I'm not sure if this is possible…
One of my numerous thoughts was to put another For loop inside this For loop, and once "Potential Pair A" is found, it uses this second For loop to find its placement inside List 1 and 2. Once all potential pairs are found, it uses a third For loop (outside the first and second) to run through the lists and find the pair which has the sum of b. Then it extracts it and displays it. The issue is that I don't know if this is possible and I know for a fact it could take a super fast time running through a potentially massive pair of lists.
Another theory is to look on the internet for some already-thought-about equation or theorem that finds the solution to the entire factoring problem. Problem is that if it existed my teachers would have already shown it to us. The other is that I am feeling lazy, leading to the entire thought about this program.
So if anyone has their own copy of this programming issue or has any ideas on how to accomplish this, please replay ASAP!!! I'm not a math algorithm guru, so I need your help, people!
The man shuddered as the shadow drew a glistening sword from his back. Creeping closer and closer with his pale eyes burning into the man, the shadow slowly raised his blade and before he could thrust it down, the man heard the shadow hiss something.
"The Shadow Clan's presence must be like a whisper. Always felt, but never seen…"