| Author |
Message |
copthesaint

|
Posted: Sun Feb 07, 2010 6:33 pm Post subject: RE:how can i make this faster ?? |
|
|
Seriously, methodoxx, quit acting like such a retard, If you look up I gave him a method that will get him ALL factors of x, also No freakin person is every going to use this program for finding factors (Sorry ddndd). Also Make sure you read my WHOLE post next time, ok? I SAID
"...if you really think people will use factors such as which, then just make a program that tells you if a number is a factor of another."
Quit freakin Croping my sentences.
I DIDNT SAY THEY WERNT USED, OMG, WHERE DO YOU SEE THAT? :/ some people on the internet.
Read what the topic title is: How can I make this faster? Enough said.
Edit:
Sorry for language, just a bit ticked, Also just because I said you *acting like a retard, It doesnt mean I really think you are.
|
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
chrisbrown

|
Posted: Sun Feb 07, 2010 7:38 pm Post subject: RE:how can i make this faster ?? |
|
|
| I have to apologize here, I thought you were responding to Euphoracle's post right above yours, not to the OP's. I didn't mean to offend, I guess I was having a completely different discussion.
|
|
|
|
|
 |
copthesaint

|
Posted: Mon Feb 08, 2010 1:19 am Post subject: RE:how can i make this faster ?? |
|
|
all good so anyways, we may have ruined this thread lol... Sorry ddndd lol
|
|
|
|
|
 |
Turing_Gamer

|
Posted: Mon Feb 08, 2010 8:29 am Post subject: Re: how can i make this faster ?? |
|
|
And I thought I had it , but then again that would be too easy for the RSA to figure out. Oh well
|
|
|
|
|
 |
ddndd
|
Posted: Wed Feb 10, 2010 6:34 pm Post subject: Re: how can i make this faster ?? |
|
|
i finally did it
it is much faster now and i used the idea that someone said so i dont take any credit for making it faster but here it is
what do u guys thinks ??
| Description: |
|
 Download |
| Filename: |
factors and multip.t |
| Filesize: |
1.05 KB |
| Downloaded: |
63 Time(s) |
|
|
|
|
|
 |
TerranceN
|
Posted: Wed Feb 10, 2010 7:51 pm Post subject: Re: how can i make this faster ?? |
|
|
What is the point of this line
| Turing: | exit when count > sqrt (numb ) - 1 and count < sqrt (numb ) + 1 or numb div count > sqrt (numb ) - 1 and numb div count < sqrt (numb ) + 1 |
when you already have a for loop that should go up to the sqrt of the number. Just change '1 .. numb' to '1 .. round(sqrt(numb))' and remove the exit when line.
Also, what does this do?
| Turing: | if countlast = numb div count or numblast = count then
exit
end if
numblast := numb div count
countlast := count |
What you wrote will work, but there is a lot of unneeded code. You should try adding comments to your code in order to figure out what is and isn't needed.
|
|
|
|
|
 |
ddndd
|
Posted: Wed Feb 10, 2010 8:00 pm Post subject: Re: how can i make this faster ?? |
|
|
TerranceN @ Wed Feb 10, 2010 7:51 pm wrote: What is the point of this line
| Turing: | exit when count > sqrt (numb ) - 1 and count < sqrt (numb ) + 1 or numb div count > sqrt (numb ) - 1 and numb div count < sqrt (numb ) + 1 |
when you already have a for loop that should go up to the sqrt of the number. Just change '1 .. numb' to '1 .. round(sqrt(numb))' and remove the exit when line.
Also, what does this do?
| Turing: | if countlast = numb div count or numblast = count then
exit
end if
numblast := numb div count
countlast := count |
What you wrote will work, but there is a lot of unneeded code. You should try adding comments to your code in order to figure out what is and isn't needed.
lol ya i know i have a lot of extra stuff cuz i was just trying different things for it to work, i guess i forgot to remove the extra stuff so i just need to take out a couple of stuff ...
|
|
|
|
|
 |
USEC_OFFICER

|
Posted: Wed Feb 10, 2010 9:02 pm Post subject: RE:how can i make this faster ?? |
|
|
| Wait, you have a line which really is just asking if count = sqrt (numb) twice. Also or statements don't work that way.
|
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
ddndd
|
Posted: Wed Feb 10, 2010 10:29 pm Post subject: Re: RE:how can i make this faster ?? |
|
|
USEC_OFFICER @ Wed Feb 10, 2010 9:02 pm wrote: Wait, you have a line which really is just asking if count = sqrt (numb) twice. Also or statements don't work that way.
k i just said that i was trying to make it work so i did different things im going to change it
|
|
|
|
|
 |
USEC_OFFICER

|
Posted: Thu Feb 11, 2010 12:59 pm Post subject: RE:how can i make this faster ?? |
|
|
| Well I somehow posted that before I saw your other post, so I'm sorry. *Goes into corner and sobs*
|
|
|
|
|
 |
Turing_Gamer

|
Posted: Thu Feb 11, 2010 1:02 pm Post subject: Re: how can i make this faster ?? |
|
|
You should be ashamed of yourself for hurting a dear old gramp here...*Walks to USEC_OFFICER*
There, there it's alright. I agree with you...
|
|
|
|
|
 |
ddndd
|
Posted: Thu Feb 11, 2010 4:31 pm Post subject: Re: how can i make this faster ?? |
|
|
k here u go guys this is an updated version with comments and everything although the comments arent that great cuz i really hate making comments but i think it is simple enough to understand if u have any questions u can ask
| Description: |
|
 Download |
| Filename: |
factors and multip.t |
| Filesize: |
3.04 KB |
| Downloaded: |
80 Time(s) |
|
|
|
|
|
 |
TerranceN
|
Posted: Thu Feb 11, 2010 7:57 pm Post subject: RE:how can i make this faster ?? |
|
|
[numb] [numb div count]
1 144
2 72
3 48
4 36
6 24
8 18
9 16
12 12
Notice we got all the factors by just going up to the square root of numb. So why does your for loop still go up to numb?
If you still don't understand how a for loop is supposed to work, read the tutorial here.
|
|
|
|
|
 |
ddndd
|
Posted: Fri Feb 12, 2010 3:10 pm Post subject: Re: RE:how can i make this faster ?? |
|
|
TerranceN @ Thu Feb 11, 2010 7:57 pm wrote: [numb] [numb div count]
1 144
2 72
3 48
4 36
6 24
8 18
9 16
12 12
Notice we got all the factors by just going up to the square root of numb. So why does your for loop still go up to numb?
If you still don't understand how a for loop is supposed to work, read the tutorial here.
cuz if you put for count : 1.. sqrt (numb)
there would be a error, the reason for that is the square root of the number might have a decimal and that is not allowed in a for loop ... so dont u think that i know what a for loop is ??
|
|
|
|
|
 |
TheGuardian001
|
Posted: Fri Feb 12, 2010 3:12 pm Post subject: Re: how can i make this faster ?? |
|
|
ddndd wrote:
cuz if you put for count : 1.. sqrt (numb)
there would be a error, the reason for that is the square root of the number might have a decimal and that is not allowed in a for loop ...
Which is where the beauty of the round command comes in.
|
|
|
|
|
 |
|