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)

CRGreathouse 2010-07-21 20:01

[QUOTE=science_man_88;222331]got it working for that now and I tested this in 6-7 minutes maybe 8 at most[/QUOTE]

Good, that's similar to what I have (5.5 minutes on a reasonably fast computer).

science_man_88 2010-07-21 20:04

[QUOTE=CRGreathouse;222336]Good, that's similar to what I have (5.5 minutes on a reasonably fast computer).[/QUOTE]

bad cpu then ? I have one that went obsolete 3 years ago lol.

6mn, 1,812 ms for 40 million ?
156 ms for 40000
1907 for 400,000
29,281 ms. for 4 million

science_man_88 2010-07-21 22:17

wow 77-78 posts in one day ?

science_man_88 2010-07-21 23:33

[CODE]Goldbach(n)={
my(nn=n+n);
forprime(x=2,n,if(isprime(nn-x),return(x)));
0
};
GoldbachMax(n)={
my(nn=n+n);
forprime(x=2,default(primelimit),if(isprime(nn-x),return(x)));
error("Ran out of primes at "n)
};
test(lim)={
for(n=2,min(lim\2,default(primelimit)),
if(Goldbach(n),print1(2*n,","))
);
for(n=min(lim\2,default(primelimit))+1,lim\2,
if(GoldbachMax(n),print1(2*n,","))
)
};

test(4000)[/CODE]

is there a way to take your original code (post 62 out of now 114) and make in into something you can set a I've already checked up to here don't check again thing ?

CRGreathouse 2010-07-21 23:38

[QUOTE=science_man_88;222360]is there a way to take your original code (post 62 out of now 114) and make in into something you can set a I've already checked up to here don't check again thing ?[/QUOTE]

I don't understand the question.

science_man_88 2010-07-21 23:40

[QUOTE=CRGreathouse;222362]I don't understand the question.[/QUOTE]

test(x) does all test up to x if we've already done them is there a way we could give that information to the code ?

CRGreathouse 2010-07-22 00:17

[QUOTE=science_man_88;222363]test(x) does all test up to x if we've already done them is there a way we could give that information to the code ?[/QUOTE]

Ah. Got it. Yes, I do this all the time in my programs. Usually I'd force you to figure out how to do it, but in this case I'll just do it for you -- the funny part with the primelimit makes it a little harder than it would otherwise be.

[code]test(lim,startAt=2)={
my(breakpoint=min(lim\2,default(primelimit)));
startAt=floor(startAt);
for(n=startAt,breakpoint,
if(Goldbach(n),print1(2*n,","))
);
for(n=max(startAt,breakpoint+1),lim\2,
if(GoldbachMax(n),print1(2*n,","))
)
};[/code]

So if you've already done up to 4000 and you want to check to 10000, do
[code]test(10000,4000)[/code]

The order of arguments might bother you. You can change them if you like, but I've come to prefer it this way.

science_man_88 2010-07-22 00:36

[CODE](21:35) gp > test(lim,startAt=2)={
my(breakpoint=min(lim\2,default(primelimit)));
startAt=floor(startAt);
for(n=startAt,breakpoint,
if(Goldbach(n),print1(2*n,","))
);
for(n=max(startAt,breakpoint+1),lim\2,
if(GoldbachMax(n),print1(2*n,","))
)
};
(21:35) gp > test(4000,4)
*** for: not a function: `Goldbach'.[/CODE]

what happened ?

I figured one problem out. Now it seems to start at twice my low bound.

don't worry about the syntax like that if I truly do learn Asm more I'll have to get used to things like that lol

CRGreathouse 2010-07-22 01:02

[QUOTE=science_man_88;222367]what happened ?[/QUOTE]

Dunno, just reload your file with the programs in it. You can probably just type "\r" and it will reread the last file you read in.

science_man_88 2010-07-22 12:38

[QUOTE=CRGreathouse;222371]Dunno, just reload your file with the programs in it. You can probably just type "\r" and it will reread the last file you read in.[/QUOTE]

didn't know a file existed lol. anyway I've got the cut in half method to remember but I'm doing test again.

CRGreathouse 2010-07-22 13:13

[QUOTE=science_man_88;222403]didn't know a file existed lol. anyway I've got the cut in half method to remember but I'm doing test again.[/QUOTE]

Oh. Well then save the program to a file and read it in. That way you don't lose the program just because you shut down your computer.

My standard file of the gp scripts I load every session (not including my old.gp and various specialized .gp files) is probably 20 pages long. It's not something you'd want to enter manually each time.


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

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