mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Miscellaneous Math

Reply
 
Thread Tools
Old 2010-07-23, 17:17   #155
kar_bon
 
kar_bon's Avatar
 
Mar 2006
Germany

22·727 Posts
Default

Oh, I see.

He mentioned several times, learning ASM but I think he needs first some basics in programming!

[lifting up hat] Your patience is marvellous.
kar_bon is offline   Reply With Quote
Old 2010-07-23, 21:23   #156
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

Quote:
Originally Posted by kar_bon View Post
Oh, I see.

He mentioned several times, learning ASM but I think he needs first some basics in programming!

[lifting up hat] Your patience is marvellous.
I know other languages I just suck and note I never once said I was logical
I give up I'm hopeless when I found something acting up in his code I couldn't even figure it out. also I've tried the stuff in private but why post things that aren't worth while.

edit:just found it while beat CRG's code by about 31 ms for the equivalent of doing 1-1000,but I found it slows down a lot as his code by 100000 is like 3 times as fast to check half as much ?

for(c=2,500,for(n=0,c-3,if(isprime(c-n) && isprime(c+n),print(c","n);break()))) anyway you can speed this up ?

Last fiddled with by science_man_88 on 2010-07-23 at 22:21
science_man_88 is offline   Reply With Quote
Old 2010-07-24, 17:05   #157
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

175B16 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
for(c=2,500,for(n=0,c-3,if(isprime(c-n) && isprime(c+n),print(c","n);break()))) anyway you can speed this up ?
What is it trying to do?
CRGreathouse is offline   Reply With Quote
Old 2010-07-24, 17:17   #158
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

100000110000002 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
What is it trying to do?
it's checking if c+n and c-n is prime for any n if one is found it prints it then jumps to the next n.
science_man_88 is offline   Reply With Quote
Old 2010-07-24, 17:18   #159
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24·3·5·7 Posts
Default

Quote:
Originally Posted by science_man_88
it's checking if c+n and c-n is prime for any n if one is found it prints it then jumps to the next n.
Is it a loop in the first place?
3.14159 is offline   Reply With Quote
Old 2010-07-24, 17:23   #160
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
Is it a loop in the first place?
yes but if I don't break after the first one I have to waste time finding more of them for each c value.

Last fiddled with by science_man_88 on 2010-07-24 at 17:24
science_man_88 is offline   Reply With Quote
Old 2010-07-24, 22:30   #161
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3×1,993 Posts
Default

Notice that c and n need to be of opposite parity... that'll save a few cycles.
CRGreathouse is offline   Reply With Quote
Old 2010-07-24, 22:34   #162
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24·3·5·7 Posts
Default

Quote:
Notice that c and n need to be of opposite parity... that'll save a few cycles.
Idle cycles?
3.14159 is offline   Reply With Quote
Old 2010-07-24, 23:01   #163
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
Notice that c and n need to be of opposite parity... that'll save a few cycles.
unless I do a if statement outside the second loop to determine the starting of a forstep loop equivalent to the second one I don't know how to do it.

last result computed in 4,328 ms.<- my updated code to 500,000 (which checks evens effectively to 1 Million)
last result computed in 49,266 ms.<- your gold(n) code to 1 million

second test of my code gave -500 on my first test of it I think. I should test all codes given so far.

*** last result computed in 3,812 ms. is my second test with CRGreathouses optimizations

Last fiddled with by science_man_88 on 2010-07-24 at 23:53
science_man_88 is offline   Reply With Quote
Old 2010-07-25, 00:44   #164
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

135338 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
last result computed in 4,328 ms.<- my updated code to 500,000 (which checks evens effectively to 1 Million)
last result computed in 49,266 ms.<- your gold(n) code to 1 million
Please post both scripts so I can compare!

Last fiddled with by CRGreathouse on 2010-07-25 at 00:49
CRGreathouse is offline   Reply With Quote
Old 2010-07-25, 00:51   #165
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

last result computed in 47,531 ms. <- second run of gold(n)

note: your earlier codes looked more promising than mine does now
science_man_88 is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Goldbach Conjecture MattcAnderson MattcAnderson 4 2021-04-04 19:21
Factorial and Goldbach conjecture. MisterBitcoin MisterBitcoin 17 2018-01-29 00:50
Goldbach's weak conjecture MattcAnderson MattcAnderson 19 2017-03-21 18:17
Goldbach's conjecture Citrix Puzzles 3 2005-09-09 13:58

All times are UTC. The time now is 04:47.


Fri Aug 6 04:47:12 UTC 2021 up 13 days, 23:16, 1 user, load averages: 2.62, 2.40, 3.11

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.