![]() |
|
|
#639 |
|
Aug 2006
3·1,993 Posts |
|
|
|
|
|
|
#640 |
|
Aug 2006
3×1,993 Posts |
Code:
em2(x,n,a)={
forstep(b=lift(Mod(-1,x)/n),10^a,x, print(b))
};
nonmem(a,x,m,b)={
for(n=a,x,
if(n=!mem(a,x,m,b), print(n))
)
};
mem(a,x,m,b) = {
forprime(p=a,x,
print(em2(p,m!,b))
);
};
nonmem computes this nothing, with no changes, x - a + 1 times, each time checking if n is equal to the nothing, converted to a zero and negated. So all n except for 1 (if it is in the range) are printed. So calling nonmem causes mem to be called x - a + 1 times, each time calling em2 times). In short: calling nonmem causes a whole lot of numbers to whiz by on the screen, most of them the same as earlier numbers, mostly because the same calculation is being done that was already done before. As far as "does it do what it's supposed to do?", I would guess not -- but it's hard to say for sure. Last fiddled with by CRGreathouse on 2010-08-17 at 19:44 |
|
|
|
|
|
#641 | |
|
May 2010
Prime hunting commission.
32208 Posts |
Quote:
|
|
|
|
|
|
|
#642 |
|
Aug 2006
3×1,993 Posts |
If em2 is doing what it's supposed to, then mem is clearly wrong -- it shouldn't expect a return value from a function that doesn't return anything.
|
|
|
|
|
|
#643 | |
|
May 2010
Prime hunting commission.
24·3·5·7 Posts |
Quote:
|
|
|
|
|
|
|
#644 |
|
May 2010
Prime hunting commission.
32208 Posts |
Hey: I should get back to the sieve project for the arithmetic progression prime searches. The trial division switch for PFGW just doesn't cut it.
Last fiddled with by 3.14159 on 2010-08-18 at 21:32 |
|
|
|
|
|
#645 |
|
May 2010
Prime hunting commission.
24·3·5·7 Posts |
The most recent idea is to fix mem. I will begin with Liftmodm1, which basically gives lift(Mod(-1,x)/(n)), for any x and any n. Liftmodm1 should be incorporated into mem instead of em2.
Scratch that. Liftmod has too few arguments. I'll pin a return on em2. Last fiddled with by 3.14159 on 2010-08-18 at 21:40 |
|
|
|
|
|
#646 |
|
May 2010
Prime hunting commission.
168010 Posts |
Now that I have pinned a return value instead of printing, I'll see what I can do for mem.
|
|
|
|
|
|
#647 |
|
May 2010
Prime hunting commission.
24×3×5×7 Posts |
mem repeatedly loops, and this must be resolved. That means, I'll apply the (and) condition as necessary, so there is no loop. Let's see how this works out.
Last fiddled with by 3.14159 on 2010-08-18 at 21:42 |
|
|
|
|
|
#648 |
|
May 2010
Prime hunting commission.
110100100002 Posts |
Let's try: k * 11! + 1; Apply the and condition for primes 13 through 349..
Scratched: This would also loop and repeat duplicates endlessly. Last fiddled with by 3.14159 on 2010-08-18 at 21:49 |
|
|
|
|
|
#649 |
|
May 2010
Prime hunting commission.
110100100002 Posts |
Okay: It cannot use vectors and loops, as any method using these is dreadfully inefficient.
The closest to a sieve I can manage is trial-dividing each to 106 and testing those which have no factors below 106. 3814 * p(65)#40 + 1 is prime. (≈5115-5117 digits) Last fiddled with by 3.14159 on 2010-08-18 at 21:56 |
|
|
|
![]() |
| 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 |