![]() |
|
|
#1343 |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
well if we encode it as characters for each digit it gets inefficient real quick (almost like BCD in ASM I think), I don't know the best way to encode them efficiently unless maybe we convert them to hex to take less room than the decimal and hex or another power of 2 base is easier for me to convert to binary(yes I've learned that part lol).
|
|
|
|
|
|
#1344 | |
|
Aug 2006
597910 Posts |
Quote:
You'll need some way to delimit the primes, though. |
|
|
|
|
|
|
#1345 |
|
"Forget I exist"
Jul 2009
Dumbassville
100000110000002 Posts |
let me guess the last bit won't matter as it will always be one except when the decimal representation of the prime is 2. yeah what to separate them in storage with.
|
|
|
|
|
|
#1346 | |
|
Aug 2006
3×1,993 Posts |
Quote:
You could even left-pad with 0s and include primes of up to 65 bits. This gives you 837903145466607212 to work with (and moves the storage for all of them to 418951 TB). Last fiddled with by CRGreathouse on 2010-09-07 at 22:50 |
|
|
|
|
|
|
#1347 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
Code:
a=0;forallprime(1,2^100,p->a=a+1;if(ispower(p+1),print(ispower(p+1)","p","a))) |
|
|
|
|
|
#1348 |
|
Aug 2006
3·1,993 Posts |
There are many more primes than (proper) powers, and as it happens ispower is a lot slower than isprime. So if you're able, set up the loop the other way: loop over powers and check the the primality of n-1.
This way you're checking something like 1.126 * 1015 numbers instead of 1.267 * 1030. Edit: 1125910730446094 instead of 1.856(1) * 1028, assuming (wrongly) that you've precalculated primes up to 2100. Last fiddled with by CRGreathouse on 2010-09-08 at 00:18 |
|
|
|
|
|
#1349 |
|
Jun 2003
5,087 Posts |
|
|
|
|
|
|
#1350 |
|
Aug 2006
597910 Posts |
|
|
|
|
|
|
#1351 |
|
"Forget I exist"
Jul 2009
Dumbassville
203008 Posts |
|
|
|
|
|
|
#1352 |
|
Aug 2006
175B16 Posts |
The suggestion was that b - 1 is a factor of b^k - 1, so unless b = 2 this cannot be a prime. If b = 2 then you're just looking for Mersenne primes.
|
|
|
|
|
|
#1353 |
|
"Forget I exist"
Jul 2009
Dumbassville
20C016 Posts |
best I can do of summing up the LL test is:
s=2*y*(2*k*p+1) s=4*y*k*p+(2*y) but this is useless obviously |
|
|
|
![]() |
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 |