![]() |
|
|
#78 | |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
Quote:
Last fiddled with by science_man_88 on 2015-11-05 at 17:29 |
|
|
|
|
|
#79 |
|
"Rashid Naimi"
Oct 2015
Remote to Here/There
3·5·137 Posts |
Regarding the simplified example on my reply 77, the double factorial must be of an odd number so for the sake of correctness:
p=(2x-1)!!-2^y , p<(2x-1)^2 For integers x and y. |
|
|
|
|
#80 |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
it's less than (nextprime(2x-1))^2 example find the numbers that are between 9 and 25 and don't divide by 2 3 answer 11,13, 17,19,23 because 10,12,14,16,18,20,22,and 24 all divide by 2 which our product sum does not, 15,and 21 both divide by 3 which our product sum can not.
|
|
|
|
|
#81 | ||
|
"Dana Jacobsen"
Feb 2011
Bangkok, TH
22×227 Posts |
Maybe -- it's hard to compare directly, as my code is in Perl calling GMP functions, while yours is in some Mathematica system. I'm sure the performance characteristics are very different. But it does give some idea of the time for existing methods that generate random proven primes.
Quote:
I recommend reading the paper: "Close to Uniform Prime Number Generation With Fewer Random Bits" by Pierre-Alain Fouque and Mehdi Tibouchi, 2011. It gives a good overview of some earlier methods, then shows their technique. It is targeted to a different situation than your goal, but I think it gives a good understanding of current methods for random prime generation. They also point out how one can easily skip results with small divisors. My modified A1 algorithm of course doesn't generate evens, and skips anything with factors 3-19 with simple native integer calculations -- so constructing the large integer is only done when we know the result has no tiny factors. Maurer's method will double or triple the number of bits at each step. Doubling is pretty common, using Pocklington or BLS theorem 3. Tripling is possible using BLS theorem 5 or similar. BLS75 theorem 3 says: Let N-1 = mp, where p is an odd prime such that 2p + 1 > sqrt(N). If there exists an a for which a^((N-1)/2) = -1 mod N, but a^(m/2) != -1 mod N, then N is prime.So we work backwards, starting with a small prime p verified with some deterministic method (e.g. trial division, deterministic M-R, or BPSW). Then select a random m of size such that the 2p+1> sqrt(N) holds, and N isn't obviously composite (simple divisibility checks). At this point I think it's best to do a strong pseudoprime test on N -- one modular power will verify whether we should proceed. At the sizes we're looking at, if it succeeds then we almost certainly pass the next step. Search for an a that works with the final two conditions, trying just a few values (e.g. 3 to 5) -- if we found one, then N is prime, otherwise go back to selecting a different random m. It should be clear how we can do this repeatedly to build up N to our desired size. Shawe-Taylor does a similar process. My code does the pedantic implementation from FIPS 186-4, which defines very specific methods for using SHA256 to generate a pseudo-random stream from the seed and how to construct the candidates. It also defines the method for searching for a values and uses the Pocklington test. One thing I did with my implementation of both was add a BPSW test before returning N. With a correct implementation this is a waste of time, but I've seen a different implementation goof up one of the conditions and return composites in very rare cases. The extra BPSW test is just there to catch anything like that (I'd much rather than the code assert than return a composite, and I'm willing to spend a tiny bit of extra time on it). For a billion digits you wouldn't want that :). There are other modifications one could make to speed things up for generating a large prime quickly vs. a random prime. Maurer's method, for instance, doesn't always use the largest m possible, as it is trying to take into account the factor distribution of uniformly random N-1 values, hence often chooses something smaller. The main problem is that as the size grows, we spend more and more time selecting random m values that don't result in N being prime. This could be sped up some, e.g. (I haven't implemented it) we could sieve N-1=(m+j)p for some range of j, which would be faster than choosing random m and checking each one for divisibility. Quote:
|
||
|
|
|
|
#82 |
|
"Rashid Naimi"
Oct 2015
Remote to Here/There
3·5·137 Posts |
Thank you danaj for your expert and kind opinion. I will look into your recommended reads but doubt very much that my mathematical background is advanced enough to get understand/get much out of it.
Now for my new hobby of finding primes this is the largest so far. A 2947 digit prime: Code:
1805466980889895444152083705580546438904586504024677600165535188575543429685794077960505989625214808524915116303899705491315603164094343044084813795581043757530995487552235487902523723086567740452893727595719880372980597935541450742314924709084464477805706347801215564892828477742072237573906563782370272100579388686003721262122865977590597671663276817313957626949815633164020079618129756124758514473258952668713086668728327275687891046096802123432511845769670152445319814829069235728684165231695321332342334367088705269590536527660092629353864957805226857372134492239182271773319271671060039879398708305623924423944843161074165034154548690879881017033937390305637610815820841838308524829591690956013832210832989143539340531227350566275290758441812554637924971005663040725834078658718911848208299986651450324251660389891917952141142210279447598049220945655658626052995732959245011919822884830765020739809511578315007267171708637682291056185797473317747764366344004828507106666721146537504910198413255887344019105030885272695106644022148170279957406811811911585778607600739191941607919630180234280031608973517046509793449110316428492468696779825270101530626635344218034017307575001966882491611934891738871974963517180137793058469000240528839225740256912452059160288057505444198500439633240583962147605681672854210974037353231750759224515933944959499070415928622085379698744189526577111698223307107665376762465818342167706880502158694017253486016700231248897694374400855441474197730980037468658876592266138720858442852935844690619167220560914289672460090283731271531544337770738859857007393568030507020182480999526498540545600903227122621230800437089885978984230703506985324720816164021613478285374762602855643139663257847197959455588902981428173235460646940557633065072026465549146471366173033516852539147433182479114301404886920957104251678805504412494200796533347564550660712562917738939205873028504412308575509495761954814647711657139410849691685321052885903832951506346892246167734326681830599628039736287055861356443181022534485795392105080607228795912012553024445415098038410720044479890661532850673130219375779899531376107672518236277402316679487610396175030330672991287042582145245368628067527664022783999883065155230024645864740144778843763548011487620955941889185683824851653206897896900747451378467342402311606349922692725297663302384680026620955340896805371466046084505923777439953896738500215013385523653896095796144761307282761834587963060324115970111770272476498848789114830467810498345867446037192452020756530749047624747739018468419463872849159279940652772445668411860820516407239704696025418086495779571719406376523548257847350367035686315656048518163977035026758194250214340115912569626831728654997932815440375880817644385932476040941555231541267305721707269170287184587787567356129062681652484241589553874347773466273391056360920384479015168760367513723387661000831706805133731080182032638806917395759284450399866107468081950321 |
|
|
|
|
#83 | |
|
Jun 2003
116748 Posts |
Quote:
|
|
|
|
|
|
#84 |
|
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2
36·13 Posts |
Yep, that will work.
|
|
|
|
|
#85 | |
|
Jun 2003
13BC16 Posts |
Quote:
|
|
|
|
|
|
#86 |
|
"Rashid Naimi"
Oct 2015
Remote to Here/There
3×5×137 Posts |
Thank you for the reply axn.
The 1073 digit was checked in 18 minutes on a windows 10 desktop with this tool: http://www.alpertron.com.ar/ECM.HTM The 2947 digit is still running at more than 15 hours. A few more digits make a big difference and prove the above tool not appropriate for large primes. Fortunately the Wolfram server can confirm both in seconds. |
|
|
|
|
#87 | |
|
Nov 2003
22×5×373 Posts |
Quote:
|
|
|
|
|
|
#88 |
|
"Dana Jacobsen"
Feb 2011
Bangkok, TH
22×227 Posts |
At 2947 digits, you'll probably want to use Primo (which means a Linux machine or VM). Pari's isprime will work as well, but Primo is probably noticeably faster and gives a progress indication. Pari/GP took 4.5 minutes on your 1073 digit number on my laptop. Using BPSW on the 2947 digit number takes under a second using Pari/GP or Perl/ntheory.
Wolfram uses a BPSW variant for PrimeQ, not a proof. You'd have to use ProvablePrimeQ for a proof. Wolfram Alpha doesn't support that command so I'm not sure if your tool does or not. It returns what it claims is an ECPP certificate that its checker can parse. |
|
|
![]() |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Is CEMPLLA 1.5 "the only software in the world capable of discovering" something? Not really. | CRGreathouse | Number Theory Discussion Group | 51 | 2018-12-16 21:55 |
| Aouessare-El Haddouchi-Essaaidi "test": "if Mp has no factor, it is prime!" | wildrabbitt | Miscellaneous Math | 11 | 2015-03-06 08:17 |
| "Subproject" #10: 200k-300k to 110 digits | RobertS | Aliquot Sequences | 9 | 2011-05-07 15:30 |
| Would Minimizing "iterations between results file" may reveal "is not prime" earlier? | nitai1999 | Software | 7 | 2004-08-26 18:12 |
| Search for a number theoretic function related to "prime divisor sums" | juergen | Math | 2 | 2004-07-10 23:01 |