mersenneforum.org  

Go Back   mersenneforum.org > Math Stuff > Computer Science & Computational Number Theory > PARI/GP

Reply
 
Thread Tools
Old 2010-09-01, 19:01   #1299
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

32208 Posts
Default

Quote:
Originally Posted by Charles
Right. That's too big, though -- it double-counts 4 residues mod 108, for example, making it too large by at least 4/108 = 3.7...%.
Right..
Quote:
Originally Posted by Charles
That will be too large, since it's only removing one congruence class mod H (the huge product). You removed 1 mod H, but you also need to remove 1 + 4*27, 1 + 2*4*27, ... mod H.
109, 217, 325, 433, 541, 649, 757, ... ?

Last fiddled with by 3.14159 on 2010-09-01 at 19:03
3.14159 is offline   Reply With Quote
Old 2010-09-01, 19:51   #1300
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

69016 Posts
Default

Also: Here is the number, such that nn = 2 :

1.559610469462369349970388768765002993284883511843...

Any simple way to compute that? I had to do trial and error to get the first 10 or so digits.

Last fiddled with by 3.14159 on 2010-09-01 at 19:51
3.14159 is offline   Reply With Quote
Old 2010-09-01, 20:20   #1301
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3×1,993 Posts
Default

It's log(2)/W(log(2)). I can calculate it with
Code:
\p 1000
log(2)/LambertW(log(2))
using my program
Code:
LambertW(x)={
	my(e,t,w,ep);
	if(x <= 0,
		if (x == 0, return (0));
		if (x == -exp(-1), return (-1));
		if (x < -exp(-1), error("LambertW: "x" is out of range, exiting."))
	);

	\\ Initial approximation for iteration
	if (x < 1,
		ep = sqrt(2*exp(1)*x+2);	\\ Using ep as a temporary variable
		w = ep * (1 - ep * (1/3 + 11/72*ep)) - 1
	,	w = log(x));
	if (x>3, w = w - log(w));

	t = 1;
	ep = eps() * (1 + abs(w));	\\ ep = epsilon

	while (abs(t) > ep, \\ Main (Halley) loop, cubic convergence
		e = exp(w);
		t = w*e - x;
		t = t/(e*(w+1) - .5*(w+2)*t/(w+1));
		w = w - t
	);
	w
};
addhelp(LambertW,"Primary branch of Lambert's W function. Finds an L >= -1 such that L * exp(L) = x, where x >= -1/e.");

\\ 2 ^ -(decimal_precision * lg(10) - 1)
eps()={
	precision(2.>>(32 * ceil(precision(1.) * 0.103810252965230073370947482)), 9)
};
Be careful, though; you'll want some guard digits. If you want 10,000 digits I'd calculate it with \p 10100 just in case.

Last fiddled with by CRGreathouse on 2010-09-01 at 20:27
CRGreathouse is offline   Reply With Quote
Old 2010-09-01, 20:37   #1302
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

32208 Posts
Default

Excellent. I have turned it into the basis of my program, wroot. (Finds x such that xx = n.)

Based on w(n) being nn.

Last fiddled with by 3.14159 on 2010-09-01 at 20:37
3.14159 is offline   Reply With Quote
Old 2010-09-01, 20:48   #1303
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3×1,993 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
Excellent. I have turned it into the basis of my program, wroot. (Finds x such that xx = n.)
Presumably wroot(n)=log(n)/LambertW(log(n)). This can be calculated directly slightly more quickly by other means, but I'm sure for your purposes very little speed is needed.
CRGreathouse is offline   Reply With Quote
Old 2010-09-01, 20:50   #1304
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24×3×5×7 Posts
Default

Quote:
Originally Posted by CRGreathouse
Presumably wroot(n)=log(n)/LambertW(log(n)). This can be calculated directly slightly more quickly by other means, but I'm sure for your purposes very little speed is needed.
This is for when I wish to find an n-digit k-b-b, and it will show what the value of b is.
3.14159 is offline   Reply With Quote
Old 2010-09-01, 20:55   #1305
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3·1,993 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
This is for when I wish to find an n-digit k-b-b, and it will show what the value of b is.
I gathered as much.

You might also consider writing a script that, given b and a max-k value, estimates the number of primes.
CRGreathouse is offline   Reply With Quote
Old 2010-09-01, 21:00   #1306
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

32208 Posts
Default

Quote:
Originally Posted by CRGreathouse
You might also consider writing a script that, given b and a max-k value, estimates the number of primes.
Step 1. log(x)
Step 2. Divide by prime factors. (p)/(p-1)
Step 3. Divide result by number of candidates
Step 4. These are the amount of primes expected.
Step 5. Divide step 2 number by sieve efficiency to learn chances of finding a prime after sieving to x.

Last fiddled with by 3.14159 on 2010-09-01 at 21:02
3.14159 is offline   Reply With Quote
Old 2010-09-02, 01:28   #1307
axn
 
axn's Avatar
 
Jun 2003

5,087 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
Step 1. log(x)
Step 2. Divide by prime factors. (p)/(p-1)
Step 3. Divide result by number of candidates
Step 4. These are the amount of primes expected.
Step 5. Divide step 2 number by sieve efficiency to learn chances of finding a prime after sieving to x.
Step 1: log(N)
Step 2: Divide step 1 by (1.781*log(x)) to learn chances of finding a prime after sieving to x.

Last fiddled with by axn on 2010-09-02 at 01:29
axn is offline   Reply With Quote
Old 2010-09-02, 03:55   #1308
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

69016 Posts
Default

Quote:
Originally Posted by Axn
Step 1: log(N)
Step 2: Divide step 1 by (1.781*log(x)) to learn chances of finding a prime after sieving to x.
Something about something else comes to mind at this point..

Oh, I know!

Sieving for k * 2865728657 + 1 and k * 2328750 + 1.

(Approx. 127700 and 98900 digits, respectively.)

So, that'll register for items 1 and 15. If I prove them prime using Proth.exe, add item 20 to the list as well.
3.14159 is offline   Reply With Quote
Old 2010-09-02, 16:01   #1309
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3×1,993 Posts
Default

Back to the restricted sequence A180362:

Not that it's worth calculating -- checking bases is surely faster for tractable values -- but as a curios, the restriction is
\left\lceil\frac{\log\sqrt n}{\operatorname{W}(\log\sqrt n)}\right\rceil\le b\le\left\lfloor\frac{\log n}{\operatorname{W}(\log n)}\right\rfloor
CRGreathouse is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why do I sometimes see all the <> formatting commands when I quote or edit? cheesehead Forum Feedback 3 2013-05-25 12:56
Passing commands to PARI on Windows James Heinrich Software 2 2012-05-13 19:19
Ubiquity commands Mini-Geek Aliquot Sequences 1 2009-09-22 19:33
64-bit Pari? CRGreathouse Software 2 2009-03-13 04:22
Are these commands correct? jasong Linux 2 2007-10-18 23:40

All times are UTC. The time now is 23:13.


Fri Aug 6 23:13:25 UTC 2021 up 14 days, 17:42, 1 user, load averages: 4.40, 4.27, 4.08

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.