mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   PARI/GP (https://www.mersenneforum.org/forumdisplay.php?f=155)
-   -   PARI's commands (https://www.mersenneforum.org/showthread.php?t=13636)

3.14159 2010-09-01 19:01

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

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

109, 217, 325, 433, 541, 649, 757, ... ?

3.14159 2010-09-01 19:51

Also: Here is the number, such that n[sup]n[/sup] = 2 :

1.559610469462369349970388768765002993284883511843...

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

CRGreathouse 2010-09-01 20:20

It's log(2)/W(log(2)). I can calculate it with
[code]\p 1000
log(2)/LambertW(log(2))[/code]
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)
};[/code]

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.

3.14159 2010-09-01 20:37

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

Based on w(n) being n[sup]n[/sup].

CRGreathouse 2010-09-01 20:48

[QUOTE=3.14159;228083]Excellent. I have turned it into the basis of my program, wroot. (Finds x such that x[sup]x[/sup] = n.)[/QUOTE]

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.

3.14159 2010-09-01 20:50

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

This is for when I wish to find an n-digit k-b-b, and it will show what the value of b is.

CRGreathouse 2010-09-01 20:55

[QUOTE=3.14159;228086]This is for when I wish to find an n-digit k-b-b, and it will show what the value of b is.[/QUOTE]

I gathered as much.

You might also consider writing a script that, given b and a max-k value, estimates the number of primes. :smile:

3.14159 2010-09-01 21:00

[QUOTE=CRGreathouse]You might also consider writing a script that, given b and a max-k value, estimates the number of primes.
[/QUOTE]

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.

axn 2010-09-02 01:28

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

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.

3.14159 2010-09-02 03:55

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

Something about something else comes to mind at this point..

Oh, I know!

Sieving for k * 28657[sup]28657[/sup] + 1 and k * 2[sup]328750[/sup] + 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.

CRGreathouse 2010-09-02 16:01

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
[TEX]\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[/TEX]


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

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