![]() |
|
|
#2465 |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
I know that:
2x+1 single mersennes when x is the previous single mersenne 2x^2+4x+1 double mersennes when x is the previous double mersenne I know the relation of the exponents of a triple mersenne as they are the double mersennes but does anyone know of a general form other than (2^y+1)*(2^x-1) for triple, quadruple, quintuple, etc. mersennes ? edit: sorry wrong thread for some reason I thought this was the theory of mersenne primes thread Last fiddled with by science_man_88 on 2014-05-14 at 23:20 |
|
|
|
|
|
#2466 |
|
"Forget I exist"
Jul 2009
Dumbassville
838410 Posts |
does anyone know why they haven't merged Pol and Polrev ? I could see a newer version with {n=1} being a switch where n=1 makes it Pol and -1 makes it Polrev, though I guess that's because I'm trying to make my own version that does something like both.
|
|
|
|
|
|
#2467 |
|
Aug 2006
175B16 Posts |
|
|
|
|
|
|
#2468 |
|
"Forget I exist"
Jul 2009
Dumbassville
20C016 Posts |
I was just thinking that it would reduce the number of functions, but I can't make anything that quick my best attempt involved parsum:
Code:
Pols(t,v='x,{n=1})=if(n==1,parsum(w=1,#t-1,t[w]*v^(#t-w),t[#t]),parsum(w=2,#t,t[w]*v^(#t-(#t-w+1)),t[1]))
Last fiddled with by science_man_88 on 2014-05-17 at 19:45 |
|
|
|
|
|
#2469 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
Code:
parmatrix(m,n,{X},{Y},{expr=0})={
a=matrix(m,n,x,y,0);
parfor(x=1,n,
parvector(m,y,
a[x,y]=eval(expr)
)
)
;a
}
Last fiddled with by science_man_88 on 2014-05-22 at 22:05 |
|
|
|
|
|
#2470 |
|
Aug 2006
3·1,993 Posts |
You forgot my().
|
|
|
|
|
|
#2471 |
|
"Forget I exist"
Jul 2009
Dumbassville
203008 Posts |
It doesn't fully work as written even with my, what am I missing?
Last fiddled with by science_man_88 on 2014-05-22 at 23:53 Reason: adding question mark |
|
|
|
|
|
#2472 |
|
Aug 2006
3·1,993 Posts |
I would do
Code:
parmatrix(m,n,expr=(a,b)->0)={
my(a=matrix(m,n));
parfor(x=1,m,
for(y=1,n,
a[x,y]=expr(x,y)
)
);
a
};
Code:
f(x,y)=x^2+sigma(y); parmatrix(5, 5, f) \\ user function called by name parmatrix(4, 6, gcd) \\ built-in function called by name parmatrix(4, 4, (x,y) -> x+y) \\ anonymous function |
|
|
|
|
|
#2473 | |
|
"Forget I exist"
Jul 2009
Dumbassville
100000110000002 Posts |
Quote:
Last fiddled with by science_man_88 on 2014-05-23 at 14:14 |
|
|
|
|
|
|
#2474 |
|
Aug 2006
3·1,993 Posts |
|
|
|
|
|
|
#2475 | |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
Quote:
Code:
(11:48) gp > parmatrix(m,n,expr=(a,b)->0)={
my(a=matrix(m,n));
parfor(x=1,m,
for(y=1,n,
a[x,y]=expr(x,y)
)
);
a
};
(12:12) gp > f(x,y)=x^2+sigma(y);
(12:13) gp > parmatrix(5, 5, f)
%67 =
[0 0 0 0 0]
[0 0 0 0 0]
[0 0 0 0 0]
[0 0 0 0 0]
[0 0 0 0 0]
(12:13) gp > parmatrix(4, 6, gcd)
%68 =
[0 0 0 0 0 0]
[0 0 0 0 0 0]
[0 0 0 0 0 0]
[0 0 0 0 0 0]
(12:13) gp > parmatrix(4, 4, (x,y) -> x+y)
%69 =
[0 0 0 0]
[0 0 0 0]
[0 0 0 0]
[0 0 0 0]
|
|
|
|
|
![]() |
| 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 |