mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Miscellaneous Math (https://www.mersenneforum.org/forumdisplay.php?f=56)
-   -   Goldbach's Conjecture (https://www.mersenneforum.org/showthread.php?t=7592)

kar_bon 2010-07-23 17:17

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.

science_man_88 2010-07-23 21:23

[QUOTE=kar_bon;222573]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.[/QUOTE]

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.

[B]edit:[/B]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 ?

CRGreathouse 2010-07-24 17:05

[QUOTE=science_man_88;222626]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 ?[/QUOTE]

What is it trying to do?

science_man_88 2010-07-24 17:17

[QUOTE=CRGreathouse;222677]What is it trying to do?[/QUOTE]

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.

3.14159 2010-07-24 17:18

[QUOTE=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.[/QUOTE]

Is it a loop in the first place?

science_man_88 2010-07-24 17:23

[QUOTE=3.14159;222680]Is it a loop in the first place?[/QUOTE]

yes but if I don't break after the first one I have to waste time finding more of them for each c value.

CRGreathouse 2010-07-24 22:30

Notice that c and n need to be of opposite parity... that'll save a few cycles.

3.14159 2010-07-24 22:34

[QUOTE]Notice that c and n need to be of opposite parity... that'll save a few cycles.
[/QUOTE]

Idle cycles?

science_man_88 2010-07-24 23:01

[QUOTE=CRGreathouse;222692]Notice that c and n need to be of opposite parity... that'll save a few cycles.[/QUOTE]

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

CRGreathouse 2010-07-25 00:44

[QUOTE=science_man_88;222695]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[/QUOTE]

Please post both scripts so I can compare!

science_man_88 2010-07-25 00:51

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

note: your earlier codes looked more promising than mine does now


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

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