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)

science_man_88 2010-12-10 18:17

[CODE](14:14)>forprime(x=1,6000,c=vector(1000,n,0);c[1]=x;for(y=2,#c,c[y]=2*c[y-1]+1;for(z=1,#mersenne,if(c[y]!=mersenne[z],,print(y","z","x);break(2)))))
2,3,2
2,4,3
3,8,7
7,15,19
3,12,31
5,14,37
2,11,53
5,15,79
3,14,151
(14:16)>
[/CODE]

okay so there are exceptions to my thoughts of for each exception all the rest never hit mersenne exponents in this way however 4 in the primes under 6000 isn't that bad is it ? I might test under 10000 next.

funny how the start of the 2^x-1 chain that seems to work for this starts with 2047 and I posted post 2047.

science_man_88 2010-12-10 19:58

[QUOTE=science_man_88;241130][CODE](14:14)>forprime(x=1,6000,c=vector(1000,n,0);c[1]=x;for(y=2,#c,c[y]=2*c[y-1]+1;for(z=1,#mersenne,if(c[y]!=mersenne[z],,print(y","z","x);break(2)))))
2,3,2
2,4,3
3,8,7
7,15,19
3,12,31
5,14,37
2,11,53
5,15,79
3,14,151
(14:16)>
[/CODE]

okay so there are exceptions to my thoughts of for each exception all the rest never hit mersenne exponents in this way however 4 in the primes under 6000 isn't that bad is it ? I might test under 10000 next.

funny how the start of the 2^x-1 chain that seems to work for this starts with 2047 and I posted post 2047.[/QUOTE]


made my code faster I think lol and tested it with all primes under 500000.

[CODE]forprime(x=1,2000,c=vector(1000,n,0);c[1]=x;for(y=2,#c,c[y]=2*c[y-1]+1;if(c[y]<mersenne[#mersenne],for(z=1,#mersenne,if(c[y]==mersenne[z],print(y","z","x);break(2))),break())))[/CODE] I have tested it under 500000 and got about 9 seconds I think. mind you a lot go into the untested range.

3.14159 2010-12-10 23:19

[QUOTE=CRGreathouse;240704]Nothing to 45 digits (though I'm not quite finished with the ECM). It's almost surely a semiprime, and a hard one at that. You might have to use NFS if you want to crack it.[/QUOTE]

Or three to five days of SIQS..

CRGreathouse 2010-12-11 01:51

[QUOTE=3.14159;241167]Or three to five days of SIQS.[/QUOTE]

SIQS would work but would be quite a bit slower than NFS.

science_man_88 2010-12-11 15:43

alt(x)=if(x<128,Strchr(x),a=Vec(read("E:\\alt.txt"));print(a[x-127]))

I tried this for doing proper alt characters after 127 as my PARI didn't on it's own.

the problem is my PARI won't read anything not in a gp binary anymore and even when i renamed it .gp it told me it wasn't a gp binary but my codes file worked.

science_man_88 2010-12-11 16:50

[QUOTE=science_man_88;241280][CODE]alt(x)=if(x<128,Strchr(x),a=Vec(read("E:\\alt.txt"));print(a[x-127]))
[/CODE]
I tried this for doing proper alt characters after 127 as my PARI didn't on it's own.

the problem is my PARI won't read anything not in a gp binary anymore and even when i renamed it .gp it told me it wasn't a gp binary but my codes file worked.[/QUOTE]

forgot the code tags.

kar_bon 2010-12-13 20:58

From the other [url=http://www.mersenneforum.org/showthread.php?t=13181]thread[/url]:

Evaluate the Sum of p^p, p prime, up to m-th prime:
[code]
addhelp(SumPPowerP, "SumPPowerP(m): Returns the sum of p^p, p prime up to m-th prime p.");
SumPPowerP(m)={
my(SumPPowerP=0);
for(n=1,m,SumPPowerP+=prime(n)^prime(n));
SumPPowerP
};
[/code]

and

find the value n for which SumPPowerP(n) mod 10^m == 0
[code]
addhelp(FindSumPPPMod10, "FindSumPPPMod10(m): Return n of (SumPPowerP(n) mod 10^m == 0).");
FindSumPPPMod10(m)={
n=1;
until(SumPPowerP(n)%10^m==0,
n++
);
n
};
[/code]

so
prime(FindSumPPPMod10(1)) finds 11,
prime(FindSumPPPMod10(2)) finds 751,
prime(FindSumPPPMod10(3)) finds 1129

With an own procedure (with loop and printing) you got the values with one call.

Note: The value for n=4 will take some time!

axn 2010-12-13 21:16

[QUOTE=kar_bon;241663]From the other [url=http://www.mersenneforum.org/showthread.php?t=13181]thread[/url]:

<snip>

Note: The value for n=4 will take some time![/QUOTE]

Oh, don't do that. Seriously. That's very inefficient. Sum(n+1) = Sum(n) + prime(n+1)^(prime(n+1). So computing the sum every time from scratch is really really bad (N^2 vs N).

science_man_88 2010-12-13 22:16

[CODE](18:15)>v=vector(1000,n,(prime(n)^prime(n))%10)
%189 = [4, 7, 5, 3, 1, 3, 7, 9, 7, 9, 1, 7, 1, 7, 3, 3, 9, 1, 3, 1, 3, 9, 7, 9, 7, 1, 7, 3, 9
(18:16)>a=0;for(m=1,100,for(x=1,#v,a=a+v[x];b=10^m;if(a%b==0,print(prime(x));break()));a=0)
11
661
4397[/CODE]

cmd 2010-12-13 22:29

future [URL="http://www.youtube.com/watch?v=17DPJHNVx2Q&feature=player_embedded"]thec[/URL]

CRGreathouse 2010-12-13 23:54

[QUOTE=axn;241667]Oh, don't do that. Seriously. That's very inefficient. Sum(n+1) = Sum(n) + prime(n+1)^(prime(n+1). So computing the sum every time from scratch is really really bad (N^2 vs N).[/QUOTE]

Not really... the values increase (heuristically) super-exponentially (by which I mean not in E), so the expected penalty is ~11% rather than (N-1) * 100%.


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

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