mersenneforum.org  

Go Back   mersenneforum.org > Great Internet Mersenne Prime Search > PrimeNet

Reply
 
Thread Tools
Old 2017-09-25, 09:57   #430
bloodIce
 
bloodIce's Avatar
 
Feb 2010
Sweden

173 Posts
Default

Once upon a time, I had tried an idea to systematically walk through primes and find factors for Mersenne expos, but I was lagging on speed. It was simply:
1. For each prime number (N) starting from any range (one can start from TF432 or TF65 if one wishes), sieve and keep the primes that are mod8=(+/-1).
2. Then, one either factors (N-1)/2 until all 10^9 factors are found or just tries the list of all prime Mersenne expos if any is a factor of (N-1)/2. Lets say n1, n2, n3 are such prime expos.
3. One simply checks if 2^n1-1 is divided by N, as well 2^n2-1, 2^n3-1 to eliminate a candidate.
4. Go to next prime :-).

I was lacking computational efficiency (under python is slow :-)), but I am sure there could be a GPU code to help. I guess it looks as "search through k" as LaurV is mentioning. If one keeps the list of all primes <10^9 in memory of a GPU, the sieving code could be very efficient. Then it is couple of Mersenne TFs or none per candidate prime N.
bloodIce is offline   Reply With Quote
Old 2017-09-25, 10:03   #431
henryzz
Just call me Henry
 
henryzz's Avatar
 
"David"
Sep 2007
Cambridge (GMT/BST)

23·3·5·72 Posts
Default

Quote:
Originally Posted by Dubslow View Post
Unlike RDS, he stuck to math and facts.
I agree he did limit it to moaning rather than straying to insults. TBH it was a harsh comparison.
henryzz is online now   Reply With Quote
Old 2017-09-25, 12:37   #432
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
Jun 2011
Thailand

7×1,373 Posts
Default

Quote:
Originally Posted by henryzz View Post
You sound like RDS
Told you I learned a lot of things from this forum

Anyhow, me and ma'man are good now, he actually took it very well, and if he learned something new, I do not mind what he thinks about me. Case closed.

Last fiddled with by LaurV on 2017-09-25 at 12:39
LaurV is offline   Reply With Quote
Old 2017-09-25, 13:21   #433
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
Jun 2011
Thailand

7×1,373 Posts
Default

Quote:
Originally Posted by bloodIce View Post
If one keeps the list of all primes <10^9 in memory of a GPU, the sieving code could be very efficient.
That was exactly what my Pari snippet was doing, except sieving. I would not ask if you ran it, because then I would be accused again of being RDS-ish

If some sieving is added, then it becomes like your algorithm.

Note that to sieve, you do not need to keep any prime in memory. First of all, you can generate them as faster as access them in an indexed manner in memory (see the comments about the Erathostenes' sieve here). Second, it makes no sense to sieve higher than a a hundred thousand primes or so. Why should you waste memory to store 50 million primes? Sieving with first 40k primes (as Prime95 is doing) can find all primes to 38 bits, i.e. about 23*10^10, and it will eliminate almost all your candidates, therefore it will br faster, in that point, to make exponentiation than to continue sieving.

Even mfaktX, has sieving limit to primes below 100k, see the parameter SievePrimesMax in the mfaktc.ini, for example. And when you make tuning, it establishes itself somewhere at 80-90k (about 9000 primes). Why? because sieving higher, your candidate list becomes smaller and smaller, and after a while it will be faster to eliminate candidates doing exponentiation, than continuing to sieve.

Therefore, about 10 kilo words is all you need to store the primes used for sieving, in a vector in global RAM, and read them sequential. But you still need to split the candidates in classes, to make the storage more convenient and sieving more "uniform". If you try to program it, you will see what I mean (I "smoked" these things from all joints... hehe, still thinking about them when I have time to spare).
LaurV is offline   Reply With Quote
Old 2017-09-25, 15:25   #434
bloodIce
 
bloodIce's Avatar
 
Feb 2010
Sweden

173 Posts
Smile

Quote:
Originally Posted by LaurV View Post
That was exactly what my Pari snippet was doing, except sieving. I would not ask if you ran it, because then I would be accused again of being RDS-ish
Of course I have run your Pari-scripts . Since your original discussion with James (about "k", what will that be 5-6 years ago), and I have learned a lot from your scripts (and in general from your opinions in this forum).

Quote:
If some sieving is added, then it becomes like your algorithm.
Yeah, I know it is no-brainer, but it helps of course.

Quote:
Note that to sieve, you do not need to keep any prime in memory. First of all, you can generate them as faster as access them in an indexed manner in memory (see the comments about the Erathostenes' sieve here). Second, it makes no sense to sieve higher than a a hundred thousand primes or so. Why should you waste memory to store 50 million primes? Sieving with first 40k primes (as Prime95 is doing) can find all primes to 38 bits, i.e. about 23*10^10, and it will eliminate almost all your candidates, therefore it will br faster, in that point, to make exponentiation than to continue sieving.
With all my respect I disagree. I cannot get how accessing a pointer (to a prime) from memory can be slower than generating primes each time I need to do a mod or simple division, which will be for each prime candidate N. I just generate them once (yes, it is Erathostene's sieve) and store them. Of course I agree, this is tremendous load of memory (the trade-off).

Even better of course would be a partial factorization of a candidate (N-1)/2 to a limit 10⁹. However, higher the N, slower the factorization, expectedly. After TF60 or even earlier, I think it was faster to do all mod-divisions with the full list of primes for a candidate N, than to partially-factor it (on average). For Ns starting at >TF100 the full list of ((N-1)/2 mod Mersenne_expo ==0) would win on speed.

Quote:
Even mfaktX, has sieving limit to primes below 100k, see the parameter SievePrimesMax in the mfaktc.ini, for example. And when you make tuning, it establishes itself somewhere at 80-90k (about 9000 primes). Why? because sieving higher, your candidate list becomes smaller and smaller, and after a while it will be faster to eliminate candidates doing exponentiation, than continuing to sieve.
I meant, actually building a list of candidate expos for having that factor N. I do not eliminate in the mod/division part, but build candidate expos in that step. Every hit for me: ((N-1)/2 mod Mersenne_expo ==0) is a potential candidate to have that factor N or I am missing the bigger picture here?

Sieving is only to have mod8=(+/-1), as you pointed to me long time ago. Yes, my siever is elementary, and could be improved I am sure.

Quote:
Therefore, about 10 kilo words is all you need to store the primes used for sieving, in a vector in global RAM, and read them sequential. But you still need to split the candidates in classes, to make the storage more convenient and sieving more "uniform". If you try to program it, you will see what I mean (I "smoked" these things from all joints... hehe, still thinking about them when I have time to spare).
I agree with the "uniform load". That was my problem for my multicore version. Some cores would finish quickly then others, because of an uneven number of trial divisions in a thread. I cannot know how many divisions I need to perform to exclude a candidate N, before partially-factoring it or mod it towards a list. However, I agree I can classify the output in classes to distribute the load more evenly.

P.S. A list/array of all prime Mersenne expos <10⁹ in memory should not be more than 250 Mb if I calculate correctly (~50 000 000 x 4bytes), so it is not a huge deal in my opinion. The problem for me is that every TF I needed to perform was slow. I know that Prime95 and mfaktc are orders of magnitude quicker and I think that is what was missing.

Last fiddled with by bloodIce on 2017-09-25 at 16:02 Reason: P.S. estimates
bloodIce is offline   Reply With Quote
Old 2017-09-25, 21:22   #435
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

Quote:
Originally Posted by bloodIce View Post
Of course I have run your Pari-scripts . Since your original discussion with James (about "k", what will that be 5-6 years ago), and I have learned a lot from your scripts (and in general from your opinions in this forum).

Yeah, I know it is no-brainer, but it helps of course.

With all my respect I disagree. I cannot get how accessing a pointer (to a prime) from memory can be slower than generating primes each time I need to do a mod or simple division, which will be for each prime candidate N. I just generate them once (yes, it is Erathostene's sieve) and store them. Of course I agree, this is tremendous load of memory (the trade-off).

Even better of course would be a partial factorization of a candidate (N-1)/2 to a limit 10⁹. However, higher the N, slower the factorization, expectedly. After TF60 or even earlier, I think it was faster to do all mod-divisions with the full list of primes for a candidate N, than to partially-factor it (on average). For Ns starting at >TF100 the full list of ((N-1)/2 mod Mersenne_expo ==0) would win on speed.

I meant, actually building a list of candidate expos for having that factor N. I do not eliminate in the mod/division part, but build candidate expos in that step. Every hit for me: ((N-1)/2 mod Mersenne_expo ==0) is a potential candidate to have that factor N or I am missing the bigger picture here?

Sieving is only to have mod8=(+/-1), as you pointed to me long time ago. Yes, my siever is elementary, and could be improved I am sure.

I agree with the "uniform load". That was my problem for my multicore version. Some cores would finish quickly then others, because of an uneven number of trial divisions in a thread. I cannot know how many divisions I need to perform to exclude a candidate N, before partially-factoring it or mod it towards a list. However, I agree I can classify the output in classes to distribute the load more evenly.

P.S. A list/array of all prime Mersenne expos <10⁹ in memory should not be more than 250 Mb if I calculate correctly (~50 000 000 x 4bytes), so it is not a huge deal in my opinion. The problem for me is that every TF I needed to perform was slow. I know that Prime95 and mfaktc are orders of magnitude quicker and I think that is what was missing.
the thread you are talking about starting 5 years ago last month ( I have it bookmarked) you can know k mod 3 and use p mod 3 to show a whole set are divisible by 3 or not. so it only takes r candidates or less per prime r to show if it divides any in the arithmetic progression of candidates. etc. you can use a lot of short cuts like that.

Last fiddled with by science_man_88 on 2017-09-25 at 21:29
science_man_88 is offline   Reply With Quote
Old 2017-10-02, 22:38   #436
Madpoo
Serpentine Vermin Jar
 
Madpoo's Avatar
 
Jul 2014

CEF16 Posts
Default

Quote:
Originally Posted by ATH View Post
TJAOI actually found 827 first factors that I can find (see full lists below).
FYI there are currently 834 factors where TJAOI found the first one (as of right now). The smaller exponents are ECM of course (213 of them, up to M2440943), the rest are TF. Looks like all of the ECM stuff is using B1=50K, B2=5M.

Code:
562997
565387
568171
568643
574181
576151
582761
583577
584693
585727
592337
599843
612349
617767
622513
624917
627791
633767
635363
635939
641873
643567
645737
648289
661009
662999
668009
680341
684091
691451
692863
695407
696623
702551
705689
707219
707677
708803
713681
718723
733147
734567
739187
741101
743129
747287
749347
765619
766457
768727
771973
773831
784489
784723
791489
791851
792061
792481
796303
797383
799303
803629
805501
819263
828199
831799
840181
842141
843901
844111
844609
863867
865069
865363
870479
877783
886583
1006003
1006241
1007891
1008571
1008781
1008871
1009199
1009781
1012513
1012931
1014197
1014989
1015661
1015769
1015981
1016221
1016681
1016839
1016881
1017209
1017383
1018679
1020049
1020419
1020881
1021259
1021747
1023973
1025261
1028317
1029167
1029563
1037059
1037893
1038623
1038637
1039481
1039837
1040803
1041511
1042529
1042901
1045493
1046641
1048517
1049473
1050139
1051177
1051549
1051649
1053067
1055809
1056061
1056541
1058383
1060769
1061773
1061867
1063967
1067203
1072733
1074643
1074889
1074949
1075787
1081541
1083311
1088413
1090373
1094377
1094701
1095541
1105609
1106489
1106821
1108127
1108501
1109473
1114733
1115831
1119907
1125001
1125329
1127453
1132519
1133357
1137953
1142353
1142549
1146043
1146809
1148029
1150763
1151147
1151431
1152589
1156769
1158551
1158613
1158823
1160459
1160513
1162321
1162691
1162937
1165873
1169281
1170109
1170317
1172009
1174337
1176173
1176397
1177489
1177739
1179859
1180027
1180447
1180771
1182121
1183771
1185893
1187287
1188689
1188731
1189171
1190429
1190639
1191283
1192183
1192753
1202363
1204271
1220029
1220077
1224121
2440943
6811111
7024807
7028183
7043441
7047839
7763923
8154967
8613757
9371851
10465573
10635311
13128419
15470531
16361909
16556363
16684181
16686841
17458547
17458939
17459069
17752381
17841221
17959243
17977189
18954283
25257509
28000339
32712703
33088541
33122153
33142423
33708737
47630519
66104189
66195611
66219407
88611311
90751757
95687831
98357197
98509891
99043661
99492737
101963839
102000401
102084947
103258193
104410819
107038147
107160121
107163127
107179573
109086547
109252799
113001529
113264699
115488017
115647463
118267993
124662107
129637633
131028587
132131101
132150919
132308147
132343297
132377899
132385271
132395539
132545783
132833819
138733691
139651271
147603019
153177001
156526709
165789791
171084343
181038499
184668401
184811321
188141959
188376091
188376691
188377817
188385983
188398271
188403289
188416717
188422349
188423111
188424043
188516227
188603507
188644829
188659091
188661097
189342383
191135237
191138693
191146519
191148143
191154797
191199653
191202373
191206313
191212421
191214061
191272363
191280917
191283707
191284139
191284193
191284631
191285009
191289121
191289379
191298493
201365377
204431377
209968169
212867069
216635219
233579849
235452367
235558781
236951137
238521893
240874213
241518769
242491463
243069601
243858817
246439639
247314493
248083733
248744597
252202289
257744387
258027433
258230057
259223183
259711303
261399217
261600821
262347751
262371673
262932017
263487907
264306487
264406711
264483083
264728713
264750253
265111681
265204549
265278163
265299017
265409411
265463221
265475671
265670557
265791527
265832731
265841143
266031251
266036299
266065001
266098873
266220709
266235289
266266877
266283067
268796191
270084769
271188067
272031449
272787133
272794003
272941007
273574193
274992953
276703601
278719901
283522271
286207219
287090333
287723869
288225391
288758033
296906219
297339787
299328439
299392693
300261167
303101047
304369349
313095199
314085617
316915889
318616433
321790877
322906249
324447163
325824481
326566909
327948419
329918063
330400537
331400483
333223811
333745177
333778373
335228171
341860067
345154253
345732643
347735981
349106119
350682499
350826461
355490129
359856499
362178347
363497933
363655373
369358361
369858761
370825747
371038891
377437447
378537829
382419637
382844153
382970851
387629743
388040603
389858333
390018463
391220611
392987779
395278649
397461607
399598349
401519927
402176449
404001449
404610257
404752757
404924413
408480547
409171027
409550381
412469627
413001497
413684021
413862859
415464113
415560947
415608481
419241941
420625693
423150461
423526861
424866367
426275299
427087159
427273709
428160451
428341763
434319239
438949337
440115133
440228713
442328771
447476401
451320017
451567003
456683473
456904421
463801109
466851653
471128059
471369599
474463009
475535141
475814809
477070037
477550169
480516173
482424673
483002071
486509377
494343407
495980827
497342737
499073287
502849973
505503371
507102601
508066373
511225397
512268683
513892787
516223859
522960943
524218003
524482019
529153661
529187227
529283413
529481773
529523899
529551739
529617173
529669991
529742561
530067059
530325833
530455283
530477527
530684549
530804941
530807411
530868347
530871521
530894723
531009443
531073867
531110977
531348133
531373729
531687227
531760871
531998983
532077841
532121519
532139263
532268537
532405849
532747739
532908403
533148851
534016727
534244129
534346381
534885259
536320033
536945359
537025399
537457871
537498217
537516541
537595697
537839851
537981383
538054171
538125389
538161539
538260721
538290971
538377817
538388533
538397983
538813631
538937423
539000047
539344837
539508419
539619373
539643857
539670583
539901049
539961119
540030587
540156979
540205279
540239587
540320797
540492947
540534649
540781537
540852491
540871003
540926203
541466297
543209071
543276907
543492773
547552667
547655023
548147021
548330617
552398569
557137307
560725973
561825293
562505611
565154141
565403621
566369017
568001153
569154457
571562951
574045369
577590311
578286563
579301693
580661659
580837519
584489707
586859353
592582589
593366209
594423679
599317883
603295153
603669383
605568151
616411183
617198287
618732259
618849137
622548529
623067659
623325497
623710957
625743683
634431491
636837569
640176941
643358173
644317879
647135891
647528111
649232917
650227129
654311477
660762161
661070327
661355323
662416397
663293387
664117211
664936847
668331623
669168571
671674951
682117801
689381573
689741839
695332819
696938533
700511761
700700009
704410933
706224203
708359671
710112839
711157879
714121277
716352467
716647297
717926719
722188039
722782157
725061329
733050467
734006137
738275149
739923739
741946957
742897583
746175541
747730469
747881083
748118741
748313857
750992279
752159647
752732219
754578529
756776413
758098007
758241097
758979883
759268621
759524279
759936811
761402597
762466739
763485427
764005213
764961493
767251937
767952631
767984281
773023793
773432089
774338557
774877121
774984037
775502261
775808233
776540231
777636971
781211243
781955347
784480457
786465419
790947301
792631663
803141509
804428809
806753677
807755071
808818379
811407239
812809937
813000103
813330223
814252427
820075889
820197583
821094667
821771833
824853313
828190291
830756963
837086279
838779509
838920359
841322723
842145929
843585377
845549611
846149219
846942643
849082691
850352507
854611139
856101901
857116471
857697541
858799187
858965801
860700329
860977333
861415363
861840079
862069937
864578293
864660197
865119377
865151479
867789943
869146739
877713329
878314699
879826861
882943427
883622309
885371657
887985589
892735111
893315543
894368273
894943817
897443147
900560351
902980087
904083407
906071891
906145843
908224501
912356857
913624079
914616511
915739621
917434033
924282869
924488843
925044559
925251517
925918793
926214629
929794609
930594649
930919037
931376821
936759839
938647001
944011273
946310231
948777979
951404147
956443429
960585911
961755293
963535717
965364979
971859341
972272659
973750237
973962911
977189299
981847247
983648077
986943829
990843277
991185421
993797821
994713887
994913209
995117147
996024301
996126983
997690357
997732003
998961239
Madpoo is offline   Reply With Quote
Old 2017-10-03, 05:24   #437
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
Jun 2011
Thailand

7·1,373 Posts
Default

Yet (in the light of our former posts), to make it clear, none of the TF factors were found "by k" (i.e. missed by GIMPS, and found later by TJAOI's exhaustive search).

Or...?

(edit: i.e. you count the first factors "wrongly" in this case, hehe, the question was never about how many factors they find, but about how many factors which we missed, they find. All factors we find with mfaktX and P95's TF are first factors. We all have our own collections of "first" factors found. But the question was if and how he helps GIMPS, i.e. finding factors that actually save us LL work, by their own ("by k", or whatever) method. Again, the guy/girl/group is worth our admiration that they are following their goal, and this remark is under no way intended to diminish their merits, but we think that their resources would be much better used doing "normal" TF, from the GIMPS point of view. We do not talk about the resources they use for ECM or other types of work, and we know they are quite a "complex" contributor, we only try to compare the factoring method they are using, with the one GIMPS is using).

Last fiddled with by LaurV on 2017-10-03 at 05:35
LaurV is offline   Reply With Quote
Old 2017-10-03, 23:47   #438
flagrantflowers
 
Apr 2014

27 Posts
Default

Quote:
Originally Posted by LaurV View Post
but we think that their resources would be much better used doing "normal" TF, from the GIMPS point of view.
As always everyone is encouraged to do the work that they find interesting…


I personally find this extraordinarily interesting even if, in some peoples' opinions, it is not an ideal use of resources.
flagrantflowers is offline   Reply With Quote
Old 2017-10-08, 00:56   #439
alpertron
 
alpertron's Avatar
 
Aug 2002
Buenos Aires, Argentina

136610 Posts
Default

Quote:
Originally Posted by LaurV View Post
...you count the first factors "wrongly" in this case, hehe, the question was never about how many factors they find, but about how many factors which we missed, they find. All factors we find with mfaktX and P95's TF are first factors...
From Primenet data for M6811111 it is clear that the only prime factor known of that Mersenne number was found by TJAOI.
alpertron is offline   Reply With Quote
Old 2017-10-13, 10:23   #440
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
Jun 2011
Thailand

258B16 Posts
Default

Quote:
Originally Posted by alpertron View Post
From Primenet data for M6811111 it is clear that the only prime factor known of that Mersenne number was found by TJAOI.
OK, that's one... It didn't save GIMPS any time, however, because the 6M DC were long passed when the factor was found, but that is a clear GIMPS miss which they (TJAOI) found, and it is ok with us, based on the rule that "is nicer to expose a factor, than to expose a verified LL residue".
LaurV is offline   Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Old User Unregistered Information & Answers 1 2012-10-18 23:31
The user CP has gone :( retina Forum Feedback 5 2006-12-05 16:47
Changing My User ID endless mike NFSNET Discussion 1 2004-10-31 19:38
OSX yet? new user here KevinLee Hardware 6 2003-12-12 17:06
help for a Mac user drakkar67 Software 3 2003-02-11 10:55

All times are UTC. The time now is 19:54.


Fri Jul 16 19:54:50 UTC 2021 up 49 days, 17:42, 1 user, load averages: 1.77, 2.11, 2.38

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.