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-08-23 22:34

[QUOTE=science_man_88]best i could do i know it prints a lot I messed something up but it what I could do.
[/QUOTE]

You asked it for for every candidate that is not divisible by a certain prime. It is repeating the loop over and over for every prime.

science_man_88 2010-08-23 22:42

[QUOTE=science_man_88;226740][CODE]sievex(kmin,kmax,b,n,pmax)= for(k=kmin,kmax,forprime(p=1,pmax,if((k*b!^n+1)%p==0,,print("no factor found under "pmax" for "k"*"b"!^"n"+1"))))[/CODE]

best i could do i know it prints a lot I messed something up but it what I could do.[/QUOTE]

[CODE]sievex(kmin,kmax,b,n,pmax)= for(k=kmin,kmax,forprime(p=1,pmax,if((k*b!^n+1)%p==0 && (k*b!^n+1)!=p,print("found factor " p " for "k"*"b"!^"n"+1"))))[/CODE]

give it a wild limit and it prints a lot.

I think I could improve it one more way. should i try to help it more ?

3.14159 2010-08-23 22:50

[QUOTE=science_man_88]I think I could improve it one more way. should i try to help it more ?
[/QUOTE]

Do what you can.

science_man_88 2010-08-23 22:56

would you rather it spit out when it found a factor or when it hasn't(less printing I think).

science_man_88 2010-08-23 23:04

one thing to stop limitation (though going far enough with pmax it may slow down)
a code to check if it's above primelimit if not use the code already made if not use another code. so basically

[CODE]if(pmax>default(primelimit),code1,code2)[/CODE]

code one could increase primelimit and if it can't go high enough switch to code 2 maybe. might be harder to code.

science_man_88 2010-08-23 23:35

[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)}[/CODE]

can't get this to work like I wanted.

3.14159 2010-08-23 23:46

[QUOTE=science_man_88]can't get this to work like I wanted.
[/QUOTE]

What seems to be the error?

kar_bon 2010-08-23 23:46

[QUOTE=3.14159;226739]Here's an example for k * 19![sup]6[/sup] + 1:
[code]
k=1: factor is 241
k=1: factor is 579637
k=1: factor is 710341
k=2: factor is 31249
k=3: factor is 67
k=4: factor is 169937
k=5: factor is 47
k=7: factor is 20269
k=7: factor is 489449
k=9: factor is 43
k=9: factor is 643
k=9: factor is 3907
k=9: factor is 2897
[/code][/QUOTE]

I've inserted the k-value where the factors come from as example and verification (see [url=http://factordb.com/search.php?query=n*%2819%21%5E6%29%2B1&v=n&n=1&EC=1&E=1&Prp=1&P=1&C=1&FF=1&CF=1&of=H&pp=50&sw=Update]here[/url] for more factorizations. The first PRP is for k=150!).

3.14159 2010-08-23 23:56

[QUOTE=kar_bon]I've inserted the k-value where the factors come from as example and verification (see here for more factorizations. The first PRP is for k=150!).
[/QUOTE]

The first PRP = [code]57133839564458545904789328652610540031895535786011264182548375833179829124845398393126574488675311145377107878746854204162666250198684504466355949195922066574942592095735778929325357290444962472405416790722118445437122269675520000000000000000000000000000000000000 * 19![sup]6[/sup] + 1[/code]? O rly?

science_man_88 2010-08-23 23:57

your guess is as good as mine there Pi:

[CODE](20:53) gp > sievex(1,10,6,1,500000)
found factor 7 for 1*6!^1+1
found factor 103 for 1*6!^1+1
found factor 11 for 2*6!^1+1
found factor 131 for 2*6!^1+1
found factor 43 for 4*6!^1+1
found factor 67 for 4*6!^1+1
found factor 13 for 5*6!^1+1
found factor 277 for 5*6!^1+1
found factor 29 for 6*6!^1+1
found factor 149 for 6*6!^1+1
found factor 71 for 7*6!^1+1
found factor 7 for 8*6!^1+1
found factor 823 for 8*6!^1+1
found factor 19 for 10*6!^1+1
found factor 379 for 10*6!^1+1
time = 281 ms.
<)%p==0 && (k*b!^n+1)!=p,a=a+1)));if
time = 0 ms.
%270 = (kmin,kmax,b,n,pmax)->a=0;for
(20:54) gp > sievex(1,10,6,1,500000)[/CODE]

first sieve gives the result shown first the second sieve should show no factor for 3*6!^1+1 as it only prints if it finds no factor but it hasn't printed anything. both test had the same sievex() values

kar_bon 2010-08-24 00:09

[QUOTE=3.14159;226752]The first PRP = [code]57133839564458545904789328652610540031895535786011264182548375833179829124845398393126574488675311145377107878746854204162666250198684504466355949195922066574942592095735778929325357290444962472405416790722118445437122269675520000000000000000000000000000000000000 * 19![sup]6[/sup] + 1[/code]? O rly?[/QUOTE]

The '!' was not the factorial-sign!


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

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