mersenneforum.org  

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

Reply
 
Thread Tools
Old 2010-12-10, 18:17   #2047
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

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)>
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.

Last fiddled with by science_man_88 on 2010-12-10 at 18:31
science_man_88 is offline   Reply With Quote
Old 2010-12-10, 19:58   #2048
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

100000110000002 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
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)>
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.

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())))
I have tested it under 500000 and got about 9 seconds I think. mind you a lot go into the untested range.
science_man_88 is offline   Reply With Quote
Old 2010-12-10, 23:19   #2049
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

110100100002 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
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.
Or three to five days of SIQS..
3.14159 is offline   Reply With Quote
Old 2010-12-11, 01:51   #2050
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3·1,993 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
Or three to five days of SIQS.
SIQS would work but would be quite a bit slower than NFS.
CRGreathouse is offline   Reply With Quote
Old 2010-12-11, 15:43   #2051
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

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.

Last fiddled with by science_man_88 on 2010-12-11 at 16:19
science_man_88 is offline   Reply With Quote
Old 2010-12-11, 16:50   #2052
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

100000110000002 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
Code:
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.
forgot the code tags.
science_man_88 is offline   Reply With Quote
Old 2010-12-13, 20:58   #2053
kar_bon
 
kar_bon's Avatar
 
Mar 2006
Germany

290810 Posts
Default

From the other thread:

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
};
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
};
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!
kar_bon is offline   Reply With Quote
Old 2010-12-13, 21:16   #2054
axn
 
axn's Avatar
 
Jun 2003

13DF16 Posts
Default

Quote:
Originally Posted by kar_bon View Post
From the other thread:

<snip>

Note: The value for n=4 will take some time!
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).
axn is offline   Reply With Quote
Old 2010-12-13, 22:16   #2055
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

100000110000002 Posts
Default

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
science_man_88 is offline   Reply With Quote
Old 2010-12-13, 22:29   #2056
cmd
 
cmd's Avatar
 
"(^r'°:.:)^n;e'e"
Nov 2008
;t:.:;^

33·37 Posts
Default

future thec
cmd is offline   Reply With Quote
Old 2010-12-13, 23:54   #2057
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3·1,993 Posts
Default

Quote:
Originally Posted by axn View Post
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).
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%.
CRGreathouse is offline   Reply With Quote
Reply



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 22:31.


Fri Aug 6 22:31:28 UTC 2021 up 14 days, 17 hrs, 1 user, load averages: 3.46, 3.33, 3.24

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.