![]() |
|
|
#2234 |
|
Aug 2006
3·1,993 Posts |
Faster version:
Code:
pick(n,k)=binomial(if(n<k,n+k-1,n),k) Code:
pick(n,k)=if(n<k,binomial(n+k-1,k), binomial(n,k)) Code:
pick(n,k)=binomial(if(n<k,n+k-1,n),k) you probably just cross out the 7 * ... * 1 on top and bottom. When you give PARI binomial(9,2) it can do the same; when you give it 9!/(7!*2!) it's forced to compute the large numbers and then divide. |
|
|
|
|
|
#2235 |
|
Apr 2010
2×7 Posts |
Code:
binom(n,k)={ my(t=i=1);
if(2*k>n, k=n-k);
while(i<=k,
t=(t*n)/i;
i++; n--
);
t
}
|
|
|
|
|
|
#2236 | |
|
"Forget I exist"
Jul 2009
Dumbassville
203008 Posts |
Quote:
Code:
(19:14)>allocatemem(1) *** allocatemem: Warning: new stack size = 1024 (0.001 Mbytes). (19:15)>pick(11,1000000000) %269 = 275573207396384843474431809413623724923088088349707046408843005955895496034675000001 (19:15)>allocatemem(931987423) *** allocatemem: Warning: new stack size = 931987420 (888.812 Mbytes). (19:15)>pick1(11,1000000000) *** _!: the PARI stack overflows ! current stack size: 931987420 (888.812 Mbytes) [hint] you can increase GP stack with allocatemem() |
|
|
|
|
|
|
#2237 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
found something I find interesting now CRG:
Code:
(20:20)>for(a=1,38,print1(sum(x=1,a,pick(Me(x)%6,Me(x+1)%6)%4)%4",")) 0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0,1, Last fiddled with by science_man_88 on 2011-05-24 at 23:29 |
|
|
|
|
|
#2238 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
I made an extended version of MeVec to test this and so far the exponents for x=40 to 47( or guessing) fit this pattern.
Last fiddled with by science_man_88 on 2011-05-25 at 01:08 |
|
|
|
|
|
#2239 |
|
Aug 2006
3·1,993 Posts |
What happens if you reverse the order of the last 8?
|
|
|
|
|
|
#2240 |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
nothing I bet because late last night I realized why the pattern is set up it's because pick(a,b) with a = 1 or 5, b=1,5 will be 1 mod 4. so the sum is mostly a sum of ones ( which will only cycle mod anything) the 2 that start it 2 and 3 and 3 and 5 are 0 and 1 mod 4 so 0+1 is the start and +1 for each step after. so really all this states is that the first 3 exponents are used to set it up.
|
|
|
|
|
|
#2241 |
|
"Forget I exist"
Jul 2009
Dumbassville
100000110000002 Posts |
I've got another pattern to figure out before revealing.
|
|
|
|
|
|
#2242 | |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
okay I gave in:
Code:
(19:34)>for(x=1,47,print1(pick(prime(x),x^2-10)%x",")) 0,0,0,3,0,0,0,0,0,4,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,13,0,20,0,0,0,0,0,0,30,0,0,0,0,0,0,0,0,0,0,0,0, (19:34)>for(x=1,47,print1(pick(prime(x),x^2-5)%x",")) 0,0,2,0,0,2,0,0,0,4,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,25,0,0,0,13,0,0,28,0,0,0,0,0, (19:35)>for(x=1,47,print1(pick(MPE[x],x^2-10)%x",")) 0,0,0,3,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,0,0,0,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0, (19:35)>for(x=1,47,print1(pick(MPE[x],x^2-5)%x",")) 0,0,2,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, (19:35)>for(x=1,47,print1(MPE[x]<x^2-5",")) 0,0,0,1,1,1,1,1,1,1,1,1,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,0,0,0,0,0,0,0,0,0,0, (19:47)>for(x=1,47,print1(MPE[x]<x^2-10",")) 0,0,0,0,1,1,1,1,1,1,1,1,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,0,0,0,0,0,0,0,0,0,0, Quote:
|
|
|
|
|
|
|
#2243 | |
|
"Forget I exist"
Jul 2009
Dumbassville
100000110000002 Posts |
Quote:
the red is for proving not all primes follow the patterns 1 after the other. the green shows the patterns I think I have ( pick(Me(x),x^2-5) is 0 mod 2 and pick(Me(x),x^2-10) is 0 mod 3). the orange is to show which path of pick each Me(x) brings us through. Last fiddled with by science_man_88 on 2011-05-26 at 17:45 |
|
|
|
|
|
|
#2244 |
|
"Forget I exist"
Jul 2009
Dumbassville
838410 Posts |
not sure how to create this , I know I ignore 2,3,and 5, and I check mod 60 but I have no idea ( the pseudo-code in the Wikipedia article didn't help me as far as I can tell) otherwise.
|
|
|
|
![]() |
| 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 |