![]() |
|
|
#804 |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
got it working.
Code:
sievex(kmin,kmax,b,n,pmax)=a=0;for(k=kmin,kmax,forprime(p=1,pmax,if((k*b!^n+1)%p==0 && (k*b!^n+1)!=p,a=a+1));if(a==0,print("no factor found for"k"*"b"!^"n"+1 in this range"));a=0)
|
|
|
|
|
|
#805 | |
|
May 2010
Prime hunting commission.
168010 Posts |
Quote:
|
|
|
|
|
|
|
#806 |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
!
factorial factorial combinatorics n! means the product 1 × 2 × ... × n. 4! = 1 × 2 × 3 × 4 = 24 logical negation not propositional logic The statement !A is true if and only if A is false. A slash placed through another operator is the same as "!" placed in front. (The symbol ! is primarily from computer science. It is avoided in mathematical texts, where the notation ¬A is preferred.) !(!A) ⇔ A x ≠ y ⇔ !(x = y) according to wikipedia's table. |
|
|
|
|
|
#807 |
|
May 2010
Prime hunting commission.
24·3·5·7 Posts |
Yes, yes, I know the connotations of the "!", symbol.
I can cite a few quick examples: 7! = 5040 6 * 6 != 7. Last fiddled with by 3.14159 on 2010-08-24 at 01:38 |
|
|
|
|
|
#808 | |
|
Aug 2006
3·1,993 Posts |
Quote:
![]() I've given up trying to explain this. Here's my off-the-top-of-my-head code, with some basic comments: Code:
vk(lim,kmin,kmax,b,n,c=-1)={
my(v=vectorsmall(kmax,j,j>=kmin),start,vv,i=0);
forprime(p=2,lim,
trap(,next, \\ if p can't divide any of the members, just go on the next prime
start=lift(Mod(c,p)/Mod(b,p)^n); \\ start * b^n = c (mod p)
);
start += p*ceil((kmin-start)/p); \\ start >= kmin
forstep(j=start,kmax,p,
v[j]=0 \\ j * b^n = c (mod p)
)
);
vv=vector(sum(i=1,#v,v[i])); \\ vector for the numbers found, rather than 0/1
for(j=1,#v,if(v[j],vv[i++]=j)); \\ fill vector
vv \\ output
};
addhelp(vk, "vk(lim,kmin,kmax,b,n,{c=-1}): Returns those k with kmin <= k <= kmax for which k * b^n - c has no prime divisors up to lim.");
Code:
vk(1e6,1,10^4,19!,6,-1) Code:
B=19!^6;for(k=1,1e4,forprime(p=2,1e6,if((k*B+1)%p==0,break))) |
|
|
|
|
|
|
#809 |
|
Mar 2006
Germany
22·727 Posts |
Impressive job CRG: 200ms for k<10000!
So I've made my first script for WinPFGW, but it uses only trial factoring for small primes and PRP-test the k-values where no factor was found for. It creates a log-file like this (found primes/PRP are stored in "pfgw.log", too): Code:
146*19!^6+1: factor 47 147*19!^6+1: factor 31 148*19!^6+1: factor 41 149*19!^6+1: factor 23 150*19!^6+1: is PRP/PRIME. 151*19!^6+1: no factor found. 152*19!^6+1: factor 6269 153*19!^6+1: no factor found. 154*19!^6+1: factor 883 155*19!^6+1: factor 523 156*19!^6+1: factor 65581 157*19!^6+1: factor 113 158*19!^6+1: factor 12583 159*19!^6+1: factor 31707989 There is no code to prevent using false parameters, but that should not be a problem. Timing: 1 <= k <= 10000, factor-bound = 100000 The script run 24s (here a AMD XP +2500, 1.8GHz) and found 247 PRP/primes. |
|
|
|
|
|
#810 |
|
"Forget I exist"
Jul 2009
Dumbassville
838410 Posts |
wow even with minimal primelimit and trying a near maximal amount before length overflow with my max memory it's working up to 10^7 in under 17 seconds.
|
|
|
|
|
|
#811 | |
|
May 2010
Prime hunting commission.
32208 Posts |
Quote:
Last fiddled with by 3.14159 on 2010-08-24 at 11:48 |
|
|
|
|
|
|
#812 | |
|
May 2010
Prime hunting commission.
168010 Posts |
Quote:
Only 1.5 minutes for 500 million. Nice. Last fiddled with by 3.14159 on 2010-08-24 at 11:53 |
|
|
|
|
|
|
#813 | |
|
May 2010
Prime hunting commission.
69016 Posts |
Quote:
Also: Is it directly input to WinPFGW? Last fiddled with by 3.14159 on 2010-08-24 at 12:02 |
|
|
|
|
|
|
#814 | |
|
Mar 2006
Germany
22×727 Posts |
Quote:
That's all. You can edit the parameters you need in the script. (Need for sieve to 10^6 and 1<k<10000 about 50 seconds; window minimized!) |
|
|
|
|
![]() |
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 |