![]() |
|
|
#2047 |
|
"Forget I exist"
Jul 2009
Dumbassville
100000110000002 Posts |
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)> 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 |
|
|
|
|
|
#2048 | |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
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()))) |
|
|
|
|
|
|
#2049 |
|
May 2010
Prime hunting commission.
24×3×5×7 Posts |
|
|
|
|
|
|
#2050 |
|
Aug 2006
175B16 Posts |
|
|
|
|
|
|
#2051 |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
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 |
|
|
|
|
|
#2052 | |
|
"Forget I exist"
Jul 2009
Dumbassville
20C016 Posts |
Quote:
|
|
|
|
|
|
|
#2053 |
|
Mar 2006
Germany
B5C16 Posts |
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
};
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
};
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! |
|
|
|
|
|
#2054 | |
|
Jun 2003
117378 Posts |
Quote:
|
|
|
|
|
|
|
#2055 |
|
"Forget I exist"
Jul 2009
Dumbassville
838410 Posts |
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 |
|
|
|
|
|
#2057 |
|
Aug 2006
175B16 Posts |
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%.
|
|
|
|
![]() |
| Thread Tools | |
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 |