![]() |
|
|
#144 |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
|
|
|
|
|
|
#145 | ||
|
Aug 2006
3×1,993 Posts |
Quote:
Code:
>(6*n+1)*(12*n+1)*(18*n+1) time = 0 ms. %1 = 1296*n^3 + 396*n^2 + 36*n + 1 Quote:
You shouldn't take n as a parameter, though, since you don't use it. Doubly so since your loop variable is n and it looks confusing. You may want to take a variable that says how high to go, though -- I usually call such variables "lim". So: Code:
b(lim)={
for(n = 10^3, lim,
if(numdiv(1296*n^3 + 396*n^2 + 36*n + 1) == 8, print(n))
);
};
Code:
b(lim)={
for(n = 10^3, lim,
if(isprime(6*n+1)&isprime(12*n+1)&isprime(18*n+1), print(n))
);
};
* You're doing isprime() instead of factoring a number, which is vastly faster; * You can exit the loop early if any one of the tests fails. |
||
|
|
|
|
|
#146 |
|
May 2010
Prime hunting commission.
24×3×5×7 Posts |
I once again search for generalized Fermat primes (Exponent = 256), and for misc. primes. (Factorial-based, etc.). So far, the largest Generalized Fermat I have ever found is also the second-largest prime number I have ever found. (13050 digits)
Last fiddled with by 3.14159 on 2010-07-23 at 01:01 |
|
|
|
|
|
#147 | |
|
Aug 2006
3·1,993 Posts |
Quote:
|
|
|
|
|
|
|
#148 | |
|
May 2010
Prime hunting commission.
168010 Posts |
Quote:
Last fiddled with by 3.14159 on 2010-07-23 at 01:35 |
|
|
|
|
|
|
#149 |
|
Aug 2006
135338 Posts |
PrimeForm is usually the best exploratory tool for primes like that, though if you have a 13 kilodigit under your belt I suppose you don't need any advice.
|
|
|
|
|
|
#150 | |
|
May 2010
Prime hunting commission.
24×3×5×7 Posts |
Quote:
|
|
|
|
|
|
|
#151 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
a=0;forstep(n=2,400,[2],forprime(x=2,n/2,if(isprime(floor((.5*n-x)+(.5*n))),print(x","floor((.5*n-x)+(.5*n))","n));a=a+1;if(a>0,break()))) this is the best I could do for what I pm'd you but it only seems to work once.
|
|
|
|
|
|
#152 | |
|
Aug 2006
3·1,993 Posts |
Quote:
Code:
a=0; forstep(n=2,400,[2], forprime(x=2,n/2, if(isprime(floor((.5*n-x)+(.5*n))), print(x","floor((.5*n-x)+(.5*n))","n) ); a=a+1; if(a>0,break()) ) ) Code:
a=0; forstep(n=2,400,2, forprime(x=2,n/2, f=floor((.5*n-x)+(.5*n)); if(isprime(f), print(x","f","n) ); a++; if(a>0,break()) ) ) Code:
forstep(n=2,400,2, forprime(x=2,n/2, f=floor((.5*n-x)+(.5*n)); if(isprime(f), print(x","f","n) ); break() ) ) The best way to fix it is to break out that portion as its own function: Code:
Gold(n)={
forprime(x=2,n/2,
f=floor((.5*n-x)+(.5*n));
if(isprime(f),
print(x","f","n);
return();
);
)
};
forstep(n=2,400,2,Gold(n))
Last fiddled with by CRGreathouse on 2010-07-23 at 16:34 |
|
|
|
|
|
|
#153 | |
|
Mar 2006
Germany
1011010111002 Posts |
Quote:
So f = n-x !? I think the original form was like : Code:
if(isprime(.5*c+n) && isprime(.5*c-n) If I'm understand this correct (not yet coded with PARI), the forstep-loop chooses only even values of n. Correct? And to calculate the value f it uses 2-times the expression '.5*n'. So why not using all n-values and check for isprime(c+n) && isprime(c-n). Should be much faster without two multiplications. The output has to be changed then, too. |
|
|
|
|
|
|
#154 | |
|
Aug 2006
3×1,993 Posts |
You'll have to take that up with science_man_88. I keep suggesting things like that, but he likes the 0.5*n forms because of some connection with the interpretation of equally-spaced primes from 0.5*n. (sm88: if you do n/2 rather than 0.5*n you can avoid using floor().)
You can see his original code in post #151; I'm just cleaning it up. Quote:
Yep. Been there, done that; see post #62. Last fiddled with by CRGreathouse on 2010-07-23 at 17:13 |
|
|
|
|
![]() |
| 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 |