mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   PARI/GP (https://www.mersenneforum.org/forumdisplay.php?f=155)
-   -   PARI's commands (https://www.mersenneforum.org/showthread.php?t=13636)

science_man_88 2010-08-14 23:22

[QUOTE=CRGreathouse;225455]So's most of genealogy, frankly.



Do you know where the link on [url]http://oeis.org/classic/A146768[/url] went? It's dead now:
[url]http://www.devalco.de/quadr_Sieb_2x%5E2-1.htm[/url][/QUOTE]



the reason Macphee is hard to trace is the original spelling has 112 variants accepted now by our clan commander (our last leader got killed in 1626).

the second link failed for me lol.

3.14159 2010-08-14 23:26

... And you swallow the whole story without questioning it even [B]once[/B]? :rolleyes: + :missingteeth:

Man, you are a hoot!

3.14159 2010-08-14 23:42

Anyway: To get back on topic:

Sm88: Provide me with the method to arrive at 2[sup]127[/sup] - 1, using the snippets you posted earlier on.

CRGreathouse 2010-08-14 23:50

[QUOTE=science_man_88;225457]the second link failed for me lol.[/QUOTE]

Yes, that's why I asked about it. It was on the sequence you commented on but the link is dead. Do you know of a current location for it or an archive? Wayback has nothing.

Edit: nevermind, I found it:
[url]http://beablue.selfip.net/devalco/quadr_Sieb_2x%5E2-1.htm[/url]

science_man_88 2010-08-15 00:24

[QUOTE=CRGreathouse;225461]Yes, that's why I asked about it. It was on the sequence you commented on but the link is dead. Do you know of a current location for it or an archive? Wayback has nothing.

Edit: nevermind, I found it:
[url]http://beablue.selfip.net/devalco/quadr_Sieb_2x%5E2-1.htm[/url][/QUOTE]

the link needs updating then

science_man_88 2010-08-15 00:31

I think my favorite shows talk of crimes that people committed and then tell the cops you can't prove it (that's a confession in my opinion, saying you can't prove it is basically proof that there is something they need to prove).

CRGreathouse 2010-08-15 00:33

[QUOTE=science_man_88;225462]the link needs updating then[/QUOTE]

No worries, I took care of it. (I'm an editor, remember?)

science_man_88 2010-08-15 01:01

still the same on my end. I'll check in the next few days.

CRGreathouse 2010-08-15 01:17

[QUOTE=science_man_88;225466]still the same on my end. I'll check in the next few days.[/QUOTE]

If you look at the bottom of the page there's a 'last updated' time. When Dr. Sloane makes the updates he's been sent this will be updated and the correction will be there.

science_man_88 2010-08-15 01:39

[QUOTE=3.14159;225460]Anyway: To get back on topic:

Sm88: Provide me with the method to arrive at 2[sup]127[/sup] - 1, using the snippets you posted earlier on.[/QUOTE]

what as a prime or as a Mersenne number ?

3.14159 2010-08-15 01:43

[QUOTE=science_man_88]what as a prime or as a Mersenne number ?
[/QUOTE]

Use your snippets to show that it is a prime Mersenne number.

science_man_88 2010-08-15 01:59

[QUOTE=3.14159;225472]Use your snippets to show that it is a prime Mersenne number.[/QUOTE]

well 127-3 = 124 124/2 = 62 so index 62 of 002450 will be a number

the question becomes will that be a number contained in px+c.

p in this case seems to be a possible factor of 2^z-1.

find when it hits px+c. determine px+c from finding c as the first time 6np+/-p intersects 24m+7. in the case of a prime we would have to find a faster way as you'd have to check every possible factor 2kz+1<sqrt(2^z-1)

science_man_88 2010-08-15 13:07

sorry only have to check primes of form 2kz+1<sqrt(2^z-1)

3.14159 2010-08-15 15:03

Quick pondering: I wanted to make a quick program that would generate k's for k * n! + 1 that would give a certain prime divisor, along with a prime-numbered cofactor.
I have everything set.. But the only issue I have is: How to grab that Mod number..

Ex: Mod(-1, 71)/11! = 51
51 * 11! + 1 is divisible by 71.

PARI is only able to give it in the form Mod(51, 71).

Everything else (the forstep, etc.) is pretty much set, what hinders me is pretty much how to obtain the Mod number alone besides handwork.

Is there a way to get the Mod number on its own? Why didn't they simply do this instead:

>Mod(-1, 71)/(11!)
%1 = 51

CRGreathouse 2010-08-15 15:32

[QUOTE=3.14159;225521]How to grab that Mod number.[/QUOTE]

lift() is what you want. Also of interest is centerlift().

[QUOTE=3.14159;225521]Why didn't they simply do this instead:

>Mod(-1, 71)/(11!)
%1 = 51[/QUOTE]

Because the correct answer is the set of numbers of the form 51 + 71k, which includes more than just 51. Also, pragmatically, it's common for further calculations to use the intmod rather than just its lift over the integers.

science_man_88 2010-08-15 15:59

is there a TeX to Pari and vice versa converter there should be lol but then again it would be quick large again lol why do i come up with ideas that seem never able to be realized lol.

CRGreathouse 2010-08-15 16:05

[QUOTE=science_man_88;225524]is there a TeX to Pari and vice versa converter there should be lol but then again it would be quick large again lol why do i come up with ideas that seem never able to be realized lol.[/QUOTE]

There's the Pari command Strtex, which works passably well:
[code]Strtex((x-2)^6)
%1 = "x^6\n - 12 x^5\n + 60 x^4\n - 160 x^3\n + 240 x^2\n - 192 x\n + 64"[/code]

3.14159 2010-08-15 16:10

@CRG: I tried an example: Find multiples of 30! which have 727 as a smallest divisor, and a prime cofactor:

It only circularly printed 727.

Here is the code snippet:

[code]em(x,n,a,b)=lift(Mod(-1,x)/(n));forstep(b=(lift(Mod(-1,x)/(n))),10^(a),x,if(isprime((b*n+1)/x), print(x)))[/code]

My guess is that it treats this section as "equal to 727": b=(lift(Mod(-1,x)/(n))),10^(a)

Let's see what happens when I change it to: b==(lift(Mod(-1,x)/(n))),10^(a). (Syntax error.)

science_man_88 2010-08-15 16:18

[QUOTE=CRGreathouse;225525]There's the Pari command Strtex, which works passably well:
[code]Strtex((x-2)^6)
%1 = "x^6\n - 12 x^5\n + 60 x^4\n - 160 x^3\n + 240 x^2\n - 192 x\n + 64"[/code][/QUOTE]

for me:

[CODE](13:16) gp > Strtex(sum(x=0,101,x))
%27 = "5151"[/CODE]

doesn't seem to cut it.

CRGreathouse 2010-08-15 16:23

[QUOTE=science_man_88;225528]for me:

[CODE](13:16) gp > Strtex(sum(x=0,101,x))
%27 = "5151"[/CODE]

doesn't seem to cut it.[/QUOTE]

sum(x=0,101,x) is 5151, so that's all that Strtex ever sees. Strtex can't tell what created the 5151.

And I'm sure it's not smart enough to deal with functions. Let me check...
[code]Strtex(n->sum(x=0,n,x))
%1 = "(n)\\mapsto sum(x=0,n,x)"[/code]

Huh... not what I expected. So it can handle them in some weak sense, but it doesn't know how to translate Pari functions.

3.14159 2010-08-15 16:26

Hmm.. I finally got it to print something, but it's all incorrect.

CRGreathouse 2010-08-15 16:31

[QUOTE=3.14159;225527]@CRG: I tried an example: Find multiples of 30! which have 727 as a smallest divisor, and a prime cofactor:

It only circularly printed 727.

Here is the code snippet:

[code]em(x,n,a,b)=lift(Mod(-1,x)/(n));forstep(b=(lift(Mod(-1,x)/(n))),10^(a),x,if(isprime((b*n+1)/x), print(x)))[/code]

My guess is that it treats this section as "equal to 727": b=(lift(Mod(-1,x)/(n))),10^(a)

Let's see what happens when I change it to: b==(lift(Mod(-1,x)/(n))),10^(a). (Syntax error.)[/QUOTE]

You have all kinds of weird stuff going on in your code. For example, you start by calculating -1/n mod x, then throwing the result away, and you take an input of b which is never used (it's squashed by the b in forstep). Cleaning up the code I have
[code]em(x,n,a)={
forstep(b=lift(Mod(-1,x)/n),10^a,x,
if(isprime((b*n+1)/x), print(x))
)
};[/code]

Also, whenever you find something you print your first input, x, rather than the prime that was found or the b that generates it.

Basically, I'm confused about your code.

CRGreathouse 2010-08-15 16:33

[QUOTE=3.14159;225531]Hmm.. I finally got it to print something, but it's all incorrect.[/QUOTE]

As of today, the best TeX converters are humans. Computers may be smart enough in the future, but not now.

Maxima does a half-decent job, as I recall, but even then the generated TeX looks terrible.

3.14159 2010-08-15 16:42

[QUOTE=CRGreathouse]Also, whenever you find something you print your first input, x, rather than the prime that was found or the b that generates it.
[/QUOTE]

Blatantly false, you print (b), or else you have no idea what you found. :missingteeth:

CRGreathouse 2010-08-15 16:45

[i]You're[/i] the one who gave me code that prints x rather than b.

axn 2010-08-15 16:50

[QUOTE=3.14159;225527]Find multiples of 30! which have 727 as a smallest divisor, and a prime cofactor[/QUOTE]

I believe you may have an impossible goal, unless you care to reword.

3.14159 2010-08-15 16:55

[QUOTE=axn]I believe you may have an impossible goal, unless you care to reword.
[/QUOTE]

2387806244029343909844048936960000001 = 727 * 3284465260012852695796490972434663
4701872193030898705387204116480000001 = 727 * 6467499577759145399432192732434663
5087549851197824504644396646400000001 = 727 * 6998005297383527516704809692434663
6244582825698601902415974236160000001 = 727 * 8589522456256673868522660572434663
6630260483865527701673166766080000001 = 727 * 9120028175881055985795277532434663
9908520578284396995359303270400000001 = 727 * 13629326792688303982612521692434663
10487037065534785694245092065280000001 = 727 * 14425085372124877158521447132434663
13572458330870192088302632304640000001 = 727 * 18669131129119934096702382812434663
18971945545207153277903327723520000001 = 727 * 26096211203861283738519020252434663
20128978519707930675674905313280000001 = 727 * 27687728362734430090336871132434663
20321817348791393575303501578240000001 = 727 * 27952981222546621148973179612434663
24757110417711040266761215672320000001 = 727 * 34053796998227015497608274652434663

That clear enough for you?

[code]82493639401591419235891937280000001 = 31 * 2661085141986819975351352815483871
238727573830971952772677632000000001 = 31 * 7700889478418450089441213935483871
271618928447683644043579883520000001 = 31 * 8761900917667214323986447855483871
477189894802131714486718955520000001 = 31 * 15393222412971990789894159855483871
658092345194046016476681338880000001 = 31 * 21228785328840194079892946415483871
690983699810757707747583590400000001 = 31 * 22289796768088958314438180335483871
773212086352536935924839219200000001 = 31 * 24942325366210868900801265135483871
830771956931782395648918159360000001 = 31 * 26799095384896206311255424495483871
904777504819383701008448225280000001 = 31 * 29186371123205925838982200815483871
1003451568669518774821154979840000001 = 31 * 32369405440952218542617902575483871
1143239825790543462722489548800000001 = 31 * 36878704057759466539435146735483871
1521490403882727912337865441280000001 = 31 * 49080335609120255236705336815483871
1554381758499439603608767692800000001 = 31 * 50141347048369019471250570735483871
1603718790424507140515121070080000001 = 31 * 51732864207242165823068421615483871
1768175563508065596869632327680000001 = 31 * 57037921403485986995794591215483871
2014860723133403281401399214080000001 = 31 * 64995507197851718754883845615483871
2039529239095937049854575902720000001 = 31 * 65791265777288291930792771055483871
2055974916404292895490027028480000001 = 31 * 66321771496912674048065388015483871
2483562526421544882011756298240000001 = 31 * 80114920207146609097153428975483871
2524676719692434496100384112640000001 = 31 * 81441184506207564390334971375483871
2541122397000790341735835238400000001 = 31 * 81971690225831946507607588335483871
3026269877597287787981643448320000001 = 31 * 97621608954751218967149788655483871
3059161232213999479252545699840000001 = 31 * 98682620393999983201695022575483871
3149612457409956630247526891520000001 = 31 * 101600401851934084846694415855483871
3182503812026668321518429143040000001 = 31 * 102661413291182849081239649775483871
3568977228773030693951530598400000001 = 31 * 115128297702355828837146148335483871
3642982776660631999311060664320000001 = 31 * 117515573440665548364872924655483871
3897890774940147606660553113600000001 = 31 * 125738412094843471182598487535483871
3906113613594325529478278676480000001 = 31 * 126003664954655662241234796015483871
4013010516098638526108710993920000001 = 31 * 129451952132214146003506806255483871
4070570386677883985832789934080000001 = 31 * 131308722150899483413960965615483871
4292587030340687901911380131840000001 = 31 * 138470549365828641997141294575483871
4415929610153356744177263575040000001 = 31 * 142449342263011507876685921775483871
4514603674003491817989970329600000001 = 31 * 145632376580757800580321623535483871
4646169092470338583073579335680000001 = 31 * 149876422337752857518502559215483871
4868185736133142499152169533440000001 = 31 * 157038249552682016101682888175483871
4901077090749854190423071784960000001 = 31 * 158099260991930780336228122095483871
5378001732692173713851154432000000001 = 31 * 173483926861037861737134013935483871
5871372051942849082914688204800000001 = 31 * 189399098449769325255312522735483871
5953600438484628311091943833600000001 = 31 * 192051627047891235841675607535483871
6101611534259830921811003965440000001 = 31 * 196826178524510674897129160175483871
6364742371193524451978221977600000001 = 31 * 205314270038500788773491031535483871
6414079403118591988884575354880000001 = 31 * 206905787197373935125308882415483871
6512753466968727062697282109440000001 = 31 * 210088821515120227828944584175483871
6578536176202150445239086612480000001 = 31 * 212210844393617756298035052015483871
6710101594668997210322695618560000001 = 31 * 216454890150612813236215987695483871
6841667013135843975406304624640000001 = 31 * 220698935907607870174396923375483871
6849889851790021898224030187520000001 = 31 * 220964188767420061233033231855483871
6858112690444199821041755750400000001 = 31 * 221229441627232252291669540335483871
6891004045060911512312658001920000001 = 31 * 222290453066481016526214774255483871
6948563915640156972036736942080000001 = 31 * 224147223085166353936668933615483871
6956786754294334894854462504960000001 = 31 * 224412475944978544995305242095483871
6965009592948512817672188067840000001 = 31 * 224677728804790736053941550575483871
6989678108911046586125364756480000001 = 31 * 225473487384227309229850476015483871
7030792302181936200213992570880000001 = 31 * 226799751683288264523032018415483871
7071906495452825814302620385280000001 = 31 * 228126015982349219816213560815483871
7252808945844740116292582768640000001 = 31 * 233961578898217423106212347375483871
7409042880274120649829368463360000001 = 31 * 239001383234649053220302208495483871
7540608298740967414912977469440000001 = 31 * 243245428991644110158483144175483871
7655728039899458334361135349760000001 = 31 * 246958969029014784979391462895483871
7680396555861992102814312038400000001 = 31 * 247754727608451358155300388335483871
7836630490291372636351097733120000001 = 31 * 252794531944882988269390249455483871
7877744683562262250439725547520000001 = 31 * 254120796243943943562571791855483871
7894190360870618096075176673280000001 = 31 * 254651301963568325679844408815483871
7968195908758219401434706739200000001 = 31 * 257038577701878045207571185135483871
8132652681841777857789217996800000001 = 31 * 262343634898121866380297354735483871
8239549584346090854419650314240000001 = 31 * 265791922075680350142569364975483871
8305332293579514236961454817280000001 = 31 * 267913944954177878611659832815483871
8626023001092453226852751769600000001 = 31 * 278258806486853329898475863535483871
8650691517054986995305928458240000001 = 31 * 279054565066289903074384788975483871
8765811258213477914754086338560000001 = 31 * 282768105103660577895293107695483871
8790479774176011683207263027200000001 = 31 * 283563863683097151071202033135483871
9012496417838815599285853224960000001 = 31 * 290725690898026309654382362095483871
9119393320343128595916285542400000001 = 31 * 294173978075584793416654372335483871
9275627254772509129453071237120000001 = 31 * 299213782412016423530744233455483871
9423638350547711740172131368960000001 = 31 * 303988333888635862586197786095483871
9711437703443939038792526069760000001 = 31 * 313272183982062549638468582895483871
9793666089985718266969781698560000001 = 31 * 315924712580184460224831667695483871
9818334605948252035422958387200000001 = 31 * 316720471159621033400740593135483871
10015682733648522183048371896320000001 = 31 * 323086539795113618808011996655483871
10032128410956878028683823022080000001 = 31 * 323617045514738000925284613615483871
10270590731928037790397864345600000001 = 31 * 331309378449291541625737559535483871
10640618471366044317195514675200000001 = 31 * 343245757140840139264371441135483871
10837966599066314464820928184320000001 = 31 * 349611825776332724671642844655483871
10879080792337204078909555998720000001 = 31 * 350938090075393679964824387055483871
11010646210804050843993165004800000001 = 31 * 355182135832388736903005322735483871
11043537565420762535264067256320000001 = 31 * 356243147271637501137550556655483871
11059983242729118380899518382080000001 = 31 * 356773652991261883254823173615483871
11388896788896235293608540897280000001 = 31 * 367383767383749525600275512815483871
11693141819100818437864386723840000001 = 31 * 377198123196800594769818926575483871
11734256012371708051953014538240000001 = 31 * 378524387495861550063000468975483871
12022055365267935350573409239040000001 = 31 * 387808237589288237115271265775483871
12211180654314027575381097185280000001 = 31 * 393909053364968631463906360815483871
12244072008930739266651999436800000001 = 31 * 394970064804217395698451594735483871
12359191750089230186100157317120000001 = 31 * 398683604841588070519359913455483871
12679882457602169175991454269440000001 = 31 * 409028466374263521806175944175483871
12753888005489770481350984335360000001 = 31 * 411415742112573241333902720495483871
12918344778573328937705495592960000001 = 31 * 416720799308817062506628890095483871
12951236133190040628976397844480000001 = 31 * 417781810748065826741174124015483871
13000573165115108165882751221760000001 = 31 * 419373327906938973092991974895483871
13181475615507022467872713605120000001 = 31 * 425208890822807176382990761455483871
13288372518011335464503145922560000001 = 31 * 428657178000365660145262771695483871
13436383613786538075222206054400000001 = 31 * 433431729476985099200716324335483871
13773519998607832910748954132480000001 = 31 * 444307096729284932604804972015483871
13896862578420501753014837575680000001 = 31 * 448285889626467798484349599215483871
13946199610345569289921190952960000001 = 31 * 449877406785340944836167450095483871
[/code]

axn 2010-08-15 16:59

[QUOTE=3.14159;225538]2387806244029343909844048936960000001 = 727 * 3284465260012852695796490972434663
4701872193030898705387204116480000001 = 727 * 6467499577759145399432192732434663
5087549851197824504644396646400000001 = 727 * 6998005297383527516704809692434663
6244582825698601902415974236160000001 = 727 * 8589522456256673868522660572434663
6630260483865527701673166766080000001 = 727 * 9120028175881055985795277532434663
9908520578284396995359303270400000001 = 727 * 13629326792688303982612521692434663
10487037065534785694245092065280000001 = 727 * 14425085372124877158521447132434663
13572458330870192088302632304640000001 = 727 * 18669131129119934096702382812434663
18971945545207153277903327723520000001 = 727 * 26096211203861283738519020252434663
20128978519707930675674905313280000001 = 727 * 27687728362734430090336871132434663
20321817348791393575303501578240000001 = 727 * 27952981222546621148973179612434663
24757110417711040266761215672320000001 = 727 * 34053796998227015497608274652434663

That clear enough for you?[/QUOTE]

None of the LHS is a multiple of 30!. That clear enough for you?

3.14159 2010-08-15 17:02

[QUOTE=axn]None of the LHS is a multiple of 30!. That clear enough for you?
[/QUOTE]

k * 30! + 1 = 727n.

Everything cleared? Excellent.

science_man_88 2010-08-15 17:41

[CODE](14:09) gp > (30!)%727
%2 = 693
(14:09) gp > (30!)%%
%3 = 0
(14:10) gp > (30!)%727
%4 = 693
(14:10) gp > (30!)%%4
%5 = 0
(14:10) gp > (30!)/%4
%6 = 382760259469251166863360000000
(14:10) gp > 727%693
%7 = 34
(14:39) gp > 727%34
%8 = 13
(14:39) gp > 727%13
%9 = 12
(14:39) gp > 727%12
%10 = 7
(14:39) gp > 727%7
%11 = 6
(14:40) gp > 727%6
%12 = 1
(14:40) gp >[/CODE]

what I've tried for so far.

3.14159 2010-08-15 17:54

[QUOTE=science_man_88]what I've tried for so far.
[/QUOTE]

>Mod(-1, 727)/(30!)
%13 = Mod(278, 727)

>forstep(n=278,1e6,727,if(isprime((n*30!+1)/727), print(n)))
3913
9002
17726
19180
23542
...
987544
>

CRGreathouse 2010-08-15 17:54

[QUOTE=3.14159;225540]k * 30! + 1 = 727n.

Everything cleared? Excellent.[/QUOTE]

Here, have as many examples as you like.
[code]lpf(n)=forprime(p=2,727,if(n%p==0,return(p)));factor(n)[1,1]
forstep(k=278,1e6,727,n=k*30!+1;if(lpf(n)==727,print1(k" ")))[/code]

I find 730 with k < 10^6 and 739156 with k < 10^9.

Edit: Faster code, at least for large numbers:
[code]primorial(n)=my(pr=1);forprime(p=1,n,pr*=p);pr
P=primorial(726)/30;
forstep(n=278*30!+1,1e6*30!+1,727*30!,if(gcd(n,P)==1,print1(n\30!," ")))[/code]
No doubt this could be improved by reducing the number of congruence classes that must be checked, if you wanted to take it to 10^12.

Of course if you also want the semiprime condition just add " && isprime(n/727)". In that case there are 116 examples to a million and 99275 to a billion.

3.14159 2010-08-15 17:58

@CRG: Meh, it was merely an example:

[COLOR="Red"]P.S: 984590208798456603272674974591352925800155174351667200000001 = a * b.
a = ?
b = ?[/COLOR]

kar_bon 2010-08-15 18:24

[QUOTE=3.14159;225546]984590208798456603272674974591352925800155174351667200000001 = a * b.
a = ?
b = ?[/QUOTE]

Easy: a=2767736217171712590811493916037679; b=355738456103518130652787919.

3.14159 2010-08-15 18:33

[QUOTE=Karsten]Easy: a=2767736217171712590811493916037679; b=355738456103518130652787919.[/QUOTE]

Ah, Karsten..

Try this:

3926977978817782120812171811446076146921298887218404481814742743335404324334280021808922828450687924731740960737624418284115998083029359303967375360000000000001.

(Approx: 160 digits)

CRGreathouse 2010-08-15 18:45

Does it help if we can factor N - 1? Unfortunately it has two large prime factors:

N = 1 + 2^54 * 3^28 * 5^13 * 7^9 * 11^5 * 13^4 * 17^3 * 19^3 * 23^2 * 29^2 * 31 * 37 * 41 * 43 * 47 * 53 * 59 * 149 * 2719 * 40177 * 2154169 * 11425981639192559335306912111 * 23559568800258192242020219435698229

kar_bon 2010-08-15 18:49

Sorry to mention this... It's the wrong thread!

Purpose of this thread?

Perhaps make a "Posts from PI and SM88" - thread instead!

CRGreathouse 2010-08-15 18:53

Yes, I've thought about that too. Maybe two threads: a new 'general pi and sm discussion" on MM and a "Pari Bootcamp" on Software?

kar_bon 2010-08-15 18:56

[QUOTE=CRGreathouse;225555]Yes, I've thought about that too. Maybe two threads: a new 'general pi and sm discussion" on MM and a "Pari Bootcamp" on Software?[/QUOTE]

Yes, should be better. There're some more PARI users who can profit from those small codes without reading hundreds of posts with non-PARI contents!

science_man_88 2010-08-15 19:02

[QUOTE=kar_bon;225556]Yes, should be better. There're some more PARI users who can profit from those small codes without reading hundreds of posts with non-PARI contents![/QUOTE]

why'd you think I tried getting back on topic lol.

3.14159 2010-08-15 19:06

[QUOTE=CRGreathouse]Does it help if we can factor N - 1? Unfortunately it has two large prime factors:

N = 1 + 2^54 * 3^28 * 5^13 * 7^9 * 11^5 * 13^4 * 17^3 * 19^3 * 23^2 * 29^2 * 31 * 37 * 41 * 43 * 47 * 53 * 59 * 149 * 2719 * 40177 * 2154169 * 11425981639192559335306912111 * 23559568800258192242020219435698229[/QUOTE]

Were you trying to apply the P-1 factoring method?

[QUOTE=Karsten]Sorry to mention this... It's the wrong thread!

Purpose of this thread?

Perhaps make a "Posts from PI and SM88" - thread instead![/QUOTE]

Karsten, it's funny when you're outside of your sandbox. :missingteeth:

I think that would also be the very first *user-specific* thread around here.

[QUOTE=science_man_88]why'd you think I tried getting back on topic lol.[/QUOTE]

When were we off topic?

[QUOTE=CRGreathouse]Yes, I've thought about that too. Maybe two threads: a new 'general pi and sm discussion" on MM and a "Pari Bootcamp" on Software?[/QUOTE]

A general discussion thread belongs in the Lounge or the Soap Box, not the Misc. Maths section.

I think this post would be suited to fit in the Forum Feedback section.

CRGreathouse 2010-08-15 19:09

[QUOTE=3.14159;225558]Were you trying to apply the P-1 factoring method?[/QUOTE]

No, because I don't know anything about the powersmoothness of p-1, just about that of n-1.

[QUOTE=3.14159;225558]So you're going to make a "user-specific" section, where I/sm88 would be trapped in forever?[/QUOTE]

I think the point (IMO correct) is that this thread is off-topic.

CRGreathouse 2010-08-15 19:10

[QUOTE=3.14159;225558]A general discussion thread belongs in the Lounge or the Soap Box, not the Misc. Maths section.

I think this post would be suited to fit in the Forum Feedback section.[/QUOTE]

I don't think this is GD, though; it's about math and programming primarily.

3.14159 2010-08-15 19:16

[QUOTE=CRGreathouse]I don't think this is GD, though; it's about math and programming primarily.
[/QUOTE]

Yes, but the idea for a General Discussion forum should go in the Lounge/Soap Box. Or it should be a new forum section: Fuse the Lounge and Soap Box into General Discussion.

Mods, please move this into Forum Feedback.

science_man_88 2010-08-15 20:10

I'm pointless to this forum.

3.14159 2010-08-15 21:50

On finding k * n! + 1 primes:

I set the following params:

When n ≤ 200: Use APR-CL to prove it prime. (≈360-380 digits, max)*
When n > 200: Use 1-4 iterations of Miller-Rabin. (≈360-380+ digits)*

*Depends on the k-value used. Expect the numbers to increase if you use large k, and expect the probability to drop as well.**
** Can be made up for if factorial is fairly large (Ex: 1900!)

CRGreathouse 2010-08-15 22:04

Seems broadly reasonable. What's the DLP bound on the chance of wrongly accepting a composite, assuming they act like random numbers?

3.14159 2010-08-15 22:53

[QUOTE=CRGreathouse]Seems broadly reasonable. What's the DLP bound on the chance of wrongly accepting a composite, assuming they act like random numbers?[/QUOTE]

The odds of that are at worst 1 in 256.

CRGreathouse 2010-08-15 23:12

[QUOTE=3.14159;225587]The odds of that are at worst 1 in 256.[/QUOTE]

Worst-case at the end of your spectrum, I take it you mean. I was asking about the average case, though.

3.14159 2010-08-15 23:21

Also: I can't find any damn sieving implementations for specific files of k * n! + 1 (Multisieve only uses factorial primes and primorial primes, making it useless, NewPGen doesn't recognize k * n! + 1 unless I add an exponent to it. Quite frankly, k * (n!)[sup]x[/sup] + 1 is too slow.)

Looking for k * 2250! + 1. (18000 random k's, odds of finding a prime are 1 in 1k, with sieving that could have been improved to as much as.. 1 in 80.)

1 in 80 amongst 6575-digit primes is pretty good.

Solution: Use the trial division switch in PFGW.

CRGreathouse 2010-08-15 23:50

I've posted the [url=http://mersenneforum.org/showthread.php?p=225592]Pari bootcamp[/url] thread, as requested.

CRGreathouse 2010-08-15 23:53

[QUOTE=3.14159;225590]Also: I can't find any damn sieving implementations for specific files of k * n! + 1[/QUOTE]

So write one. Loop over the primes from n+1 to as high as you like, and for each start at k = lift(Mod(-1,p)/n!) and use a step size of lift(Mod(1,p)/n!) to mark off candidates. (Check what I said in case of mistakes of finger or mind.)

3.14159 2010-08-15 23:56

[QUOTE=CRGreathouse]So write one. Loop over the primes from n+1 to as high as you like, and for each start at k = lift(Mod(-1,p)/n!) and use a step size of lift(Mod(1,p)/n!) to mark off candidates. (Check what I said in case of mistakes of finger or mind.)
[/QUOTE]

Nono, I have PFGW's trial division switch to help out. But, can you write a script anyway? Thank you.

[QUOTE=CRGreathouse]I've posted the Pari bootcamp thread, as requested.
[/QUOTE]

I can't go to a private forum.

CRGreathouse 2010-08-15 23:58

[QUOTE=3.14159;225595]Nono, I have PFGW's trial division switch to help out. But, can you write a script anyway? Thank you.[/QUOTE]

I just wrote half of it -- can you complete it?

Sieving is a lot more efficient than trial division.

science_man_88 2010-08-15 23:59

[CODE]for(n=1,10,for(k=1,20,if(isprime(k*n!+1),print(k","n))))[/CODE]

is what I did.

3.14159 2010-08-16 00:00

[QUOTE=CRGreathouse]I just wrote half of it -- can you complete it?

Sieving is a lot more efficient than trial division.[/QUOTE]

Show me the script. That will answer the question:

Also: How is sieving [B]not[/B] wide-range trial-division?

CRGreathouse 2010-08-16 00:03

[QUOTE=3.14159;225598]Show me the script.[/QUOTE]

I didn't write it, and don't intend on writing it.

[QUOTE=3.14159;225598]How is sieving [B]not[/B] wide-range trial-division?[/QUOTE]

I've tried to explain this to you twice, and I failed both times. I guess I'm not that good of a teacher. :no:

3.14159 2010-08-16 00:04

[QUOTE=CRGreathouse]I've tried to explain this to you twice, and I failed both times. I guess I'm not that good of a teacher.
[/QUOTE]

Nevermind, I get it now.

1. Establish the first number larger than p such that n%p = 0. (Ex: 311, 622%311 = 0.)
2. Count by p and cross off.

That it?

CRGreathouse 2010-08-16 00:05

[QUOTE=science_man_88;225597][CODE]for(n=1,10,for(k=1,20,if(isprime(k*n!+1),print(k","n))))[/CODE]

is what I did.[/QUOTE]

Yes. The intent is to avoid as many isprime() calls as possible, though. When you're working with numbers that take a long time to test you don't want to run extra checks.

I wrote a quick siever today for a problem I'm working on, and it managed to remove about 200,000 candidates, saving what would have otherwise been a few months of work. :smile:

CRGreathouse 2010-08-16 00:08

[QUOTE=3.14159;225600]Nevermind, I get it now.

1. Establish the first number larger than p such that n%p = 0. (Ex: 311, 622%311 = 0.)
2. Count by p and cross off.[/QUOTE]

Yes, that's the basic idea. #2 has to be modified when you're working with numbers that aren't consecutive, like k * n! + 1 or k * 2^n + 1. I gave the relevant calculations (hopefully correct!) above.

3.14159 2010-08-16 00:12

[QUOTE=CRGreathouse]Yes, that's the basic idea. #2 has to be modified when you're working with numbers that aren't consecutive, like k * n! + 1 or k * 2^n + 1. I gave the relevant calculations (hopefully correct!) above.
[/QUOTE]

You mean, these?:

[QUOTE=CRGreathouse]So write one. Loop over the primes from n+1 to as high as you like, and for each start at k = lift(Mod(-1,p)/n!) and use a step size of lift(Mod(1,p)/n!) to mark off candidates. (Check what I said in case of mistakes of finger or mind.)
[/QUOTE]

[QUOTE=CRGreathouse]I didn't write it, and don't intend on writing it.
[/QUOTE]

How in the world did you manage to contradict yourself so vividly?
This, to me, is a glaring red flag.

CRGreathouse 2010-08-16 00:17

[QUOTE=3.14159;225605]How in the world did you manage to contradict yourself so vividly?[/QUOTE]

I see no contradiction.

science_man_88 2010-08-16 00:19

[QUOTE=CRGreathouse;225606]I see no contradiction.[/QUOTE]

how is telling you to write something Pi a contradiction of I didn't write one I don't plan on such a thing. it's not.

3.14159 2010-08-16 00:20

[QUOTE=science_man_88]how is telling you to write something Pi a contradiction of I didn't write one I don't plan on such a thing. it's not.
[/QUOTE]

Doesn't "I wrote 1/2 of the script", and "I did not write it, nor do I intend to write it", sound a bit like 1 = 2 to you?

P.S: 816280180 * 2250! + 1 is prime. (≈6575 digits)

CRGreathouse 2010-08-16 00:23

[QUOTE=3.14159;225608]Doesn't "I wrote 1/2 of the script", and "I did not write it, nor do I intend to write it", sound a bit like 1 = 2 to you?[/QUOTE]

No. I wrote the key calculations for the script, in the scripting language. I did not write the script that would contain those calculations. (If it's not worth your time to do it, why would it be worth mine?)

3.14159 2010-08-16 01:01

[QUOTE=CRGreathouse]No. I wrote the key calculations for the script, in the scripting language. I did not write the script that would contain those calculations. (If it's not worth your time to do it, why would it be worth mine?)
[/QUOTE]

You failed to specify that.

Also: It would be a difficult task to write a sieve for k * n! + 1 in PARI/GP

3.14159 2010-08-16 01:13

You suggested the use of lift(Mod(-1,x)/(n!)) and lift(Mod(1,x)/(n!))

CRGreathouse 2010-08-16 01:13

[QUOTE=3.14159;225611]You failed to specify that.[/QUOTE]

[i]I[/i] think I was pretty clear, but if it didn't come across that way I suppose that speaks to my communications skills.

Somehow I really just don't enjoy writing sieves. I just wrote one today (on a project with Vladimir Shevelev) and I've been working on a specialized siever for one of my sequences in the OEIS. The quick ones (yours and the one I made for Vladimir) aren't too bad, but this other one has been just draining... it's a pain, since this one needs to be really efficient (since it will run over the course of several months).

CRGreathouse 2010-08-16 01:14

[QUOTE=3.14159;225612]You suggested the use of lift(Mod(-1,x)/(n!))[/QUOTE]

Yes, I think that's the right calculation. Check it with an example before trusting me, though... I've already messed up one siever today. :down: Ugh, lost 6 hours of work with that one.

For my earlier sieve the calculations were essentially
[code]b=znorder(Mod(2,p));
a=znlog(2293,Mod(2,p),b);[/code]
once I strip out all the unrelated junk. But that's variable-exponent, not variable-factor.

3.14159 2010-08-16 11:56

[QUOTE=CRGreathouse]Somehow I really just don't enjoy writing sieves. I just wrote one today (on a project with Vladimir Shevelev) and I've been working on a specialized siever for one of my sequences in the OEIS. The quick ones (yours and the one I made for Vladimir) aren't too bad, but this other one has been just draining... it's a pain, since this one needs to be really efficient (since it will run over the course of several months).
[/QUOTE]

What sequence is it that you have been working for?

[QUOTE=CRGreathouse]Yes, I think that's the right calculation. Check it with an example before trusting me, though... I've already messed up one siever today. :down: Ugh, lost 6 hours of work with that one.
[/QUOTE]

Ouch.

Mod(-1,p)/(n!) gives the smallest k for which (k * n! + 1)%p=0, and Mod(1,p)/(n!) gives the smallest k for which (k * n! -1)%p=0.

I'm searching for k * n! + 1. Mod(-1,p)/(n!) will help me a bit more here.

CRGreathouse 2010-08-16 12:29

[QUOTE=3.14159;225650]What sequence is it that you have been working for?[/QUOTE]

[url]http://oeis.org/classic/A176494[/url] -- see the seqfan archives if you're interested.

[QUOTE=3.14159;225650]Mod(-1,p)/(n!) gives the smallest k for which (k * n! + 1)%p=0, and Mod(1,p)/(n!) gives the smallest k for which (k * n! -1)%p=0.

I'm searching for k * n! + 1. Mod(-1,p)/(n!) will help me a bit more here.[/QUOTE]

Right. So start at the place where k * n! + 1 is 0, and repeatedly add on the k-value where k * n! = 1 mod p. Yes?

3.14159 2010-08-16 12:32

Since the point of a sieve is to avoid trial division: (forstep) loops. :tu:

At this point, I can get rid of specific divisors, but not groups of them.

[QUOTE=CRGreathouse]Right. So start at the place where k * n! + 1 is 0, and repeatedly add on the k-value where k * n! = 1 mod p. Yes?
[/QUOTE]

Ex: 229.
>Mod(-1, 229)/(22!)
%1 = Mod(105, 229)

105 * 22! + 1 = 0 mod 229. In other words, 105 * 22! + 1 is divisible by 229.

>Mod(1, 229)/(22!)
%1 = Mod(124, 229)

So the forstep= (n=105,a,124,..) ?

3.14159 2010-08-16 12:49

If so, that is incorrect, because it would also kick out prime numbers. (Ex: 9405 * 22! + 1 is prime.)

CRGreathouse 2010-08-16 12:49

Maybe the step size just needs to be the prime itself?

3.14159 2010-08-16 12:52

[QUOTE=CRGreathouse]Maybe the step size just needs to be the prime itself?
[/QUOTE]

Yep. Step = 229.

(Verified, every k value after 105 that was of the form 105 + 229a yielded a k * 22! + 1 value that was divisible by 229.)

3.14159 2010-08-16 12:57

So, the forstep is set.

forstep(n=105,a,229,if((n*22!+1)%229==0,print(n)))

But that only gets rid of one divisor, 229. What if we wished to get rid of 229 and 233?

One suggestion I received was to write two or more separate commands within one script: One for each divisor.

A forstep command for 229, and a separate forstep command for 233, within the same script. Excellent.

CRGreathouse 2010-08-16 13:47

[QUOTE=3.14159;225662]But that only gets rid of one divisor, 229. What if we wished to get rid of 229 and 233?[/QUOTE]

Duh, wrap the whole thing in a forprime(p=229,233, ___). :smile:

That's why you want the calculations to find the starting point rather than just finding it on your own beforehand.

3.14159 2010-08-16 14:11

[QUOTE=CRGreathouse]Duh, wrap the whole thing in a forprime(p=229,233, ___).
[/QUOTE]

forprime(p=a,b,forstep(n=lift(Mod(-1,p)/(x!),10^m,p,...)?

CRGreathouse 2010-08-16 14:13

I have to drag you kicking and screaming, don't I.

So inside the loop you know that exponent n is bad (creates a number divisible by p). So you need to have a list of numbers and mark number n as bad (whatever value you choose for that).

3.14159 2010-08-16 14:25

[QUOTE=CRGreathouse]So inside the loop you know that exponent n is bad (creates a number divisible by p). So you need to have a list of numbers and mark number n as bad (whatever value you choose for that).
[/QUOTE]

A particular k-value is bad if k * n! + 1 makes a value divisible by a small prime.
If a certain k * n! + 1 is divisible by, let's say, 2550871, I would make a forstep loop, where the step size = 2550871, where all the k-values that would be divisible by 2550871 are eliminated.

If n = 430, and k goes up to 10[sup]8[/sup]:

Eliminated k's are:

[code]702669
3253540
5804411
8355282
10906153
13457024
16007895
18558766
21109637
23660508
26211379
28762250
31313121
33863992
36414863
38965734
41516605
44067476
46618347
49169218
51720089
54270960
56821831
59372702
61923573
64474444
67025315
69576186
72127057
74677928
77228799
79779670
82330541
84881412
87432283
89983154
92534025
95084896
97635767[/code]

I would have to code that to exclude those numbers, as I know they form a k * 430! + 1 that is divisible by 2550871.

Or: A smaller prime: 577.
There would be 173310 k-values eliminated by 577.

3.14159 2010-08-16 14:53

I thought of a code snippet:
Note: e = variable, not 2.718281828459045..
kfacsieve(a,x,e,b) = {
forprime(p=a,x,
forstep(n=lift(Mod(-1,p)/(e!),10^b,p,print(n))
);
}


(Please check for any errors I might have made there.)

CRGreathouse 2010-08-16 14:54

OK. Now show what's left, not what's removed. You'll generally want to sieve out all the primes in a large range (at the very least 3 to 1e6).

3.14159 2010-08-16 14:58

[QUOTE=CRGreathouse]OK. Now show what's left, not what's removed. You'll generally want to sieve out all the primes in a large range (at the very least 3 to 1e6).
[/QUOTE]

How can I do that? Forstep is only capable of showing what's removed.

CRGreathouse 2010-08-16 15:09

[QUOTE=3.14159;225676]How can I do that? Forstep is only capable of showing what's removed.[/QUOTE]

Clearly this is false. Just store the information instead of printing it.

3.14159 2010-08-16 15:35

[QUOTE=CRGreathouse]Clearly this is false. Just store the information instead of printing it.
[/QUOTE]

There is no such option.

CRGreathouse 2010-08-16 16:12

Ah, so I must have been lying about having constructed a sieve in Pari earlier, and I must be intentionally misleading you now.

3.14159 2010-08-16 16:25

[QUOTE=CRGreathouse]Ah, so I must have been lying about having constructed a sieve in Pari earlier, and I must be intentionally misleading you now.
[/QUOTE]

Not exactly what I said, but cool strawman, anyway.

CRGreathouse 2010-08-16 16:39

[QUOTE=3.14159;225688]Not exactly what I said, but cool strawman, anyway.[/QUOTE]

You claimed that there is no option for storing the information. This seems to directly imply that I could not have stored the information. Combined with the fact that I claimed to have, your claim is tantamount to calling my statement a lie.

So no, not really a strawman at all.

kar_bon 2010-08-16 16:54

Only 2 threads he posted and read more about others and forgot the tiny letter "v" used in several posts to storing information?

CRGreathouse 2010-08-16 17:05

[QUOTE=kar_bon;225694]Only 2 threads he posted and read more about others and forgot the tiny letter "v" used in several posts to storing information?[/QUOTE]

Yes, or whatever variable you like. An integer suffices, with bitor/bitand/bitxor; a vector is a natural choice; a vectorsmall is better; for space, a custom data structure packing 32 or 64 numbers into each component of a vectorsmall is a better choice.

3.14159 2010-08-16 18:52

[QUOTE=CRGreathouse]Yes, or whatever variable you like. An integer suffices, with bitor/bitand/bitxor; a vector is a natural choice; a vectorsmall is better; for space, a custom data structure packing 32 or 64 numbers into each component of a vectorsmall is a better choice.
[/QUOTE]

Excellent. I can only log the removed numbers.

Error in the code snippet: [code]*** too many arguments: ...lift(Mod(-1,p)/(e!),10^b,p,print(n)))));
^------------[/code]

I thought I clearly defined the variables in the code snippet.

science_man_88 2010-08-16 20:31

[QUOTE=3.14159;225674]I thought of a code snippet:
Note: e = variable, not 2.718281828459045..
kfacsieve[COLOR="Red"]([/COLOR]a,x,e,b[COLOR="Red"])[/COLOR] = [COLOR="Yellow"]{[/COLOR]
forprime[COLOR="Lime"]([/COLOR]p=a,x,
forstep[COLOR="Cyan"]([/COLOR]n=lift[COLOR="DarkOrchid"]([/COLOR]Mod[COLOR="Blue"]([/COLOR]-1,p[COLOR="Blue"])[/COLOR]/[COLOR="Magenta"]([/COLOR]e![COLOR="Magenta"])[/COLOR],10^b,p,print[COLOR="DarkOrange"]([/COLOR]n[COLOR="DarkOrange"])[/COLOR][COLOR="Cyan"])[/COLOR]
[COLOR="lime"])[/COLOR];
[COLOR="yellow"]}[/COLOR]


(Please check for any errors I might have made there.)[/QUOTE]


I think I know what's wrong but I don't quite know what the code should be.

want my help ?

3.14159 2010-08-16 20:48

[QUOTE=science_man_88]I think I know what's wrong but I don't quite know what the code should be.

want my help ?[/QUOTE]

That would be of great value.

Also: I'm going to do some work on a c120, hopefully this can manage a new record: (It's probably a p(58-59) * p(61-62))

science_man_88 2010-08-16 20:52

[QUOTE=3.14159;225732]That would be of great value.[/QUOTE]

look at my post that I colored only one parenthesis isn't in a pair of them fix this into a pair.

science_man_88 2010-08-16 21:06

in other words you forgot to close the lift function so it read as too many arguments....

3.14159 2010-08-16 21:08

[QUOTE=science_man_88]in other words you forgot to close the lift function so it read as too many arguments....
[/QUOTE]

Ah, okay. That'll be fixed.

[QUOTE=3.14159]Also: I'm going to do some work on a c120, hopefully this can manage a new record: (It's probably a p(58-59) * p(61-62))
[/QUOTE]

This, I'm going to have to retract. This would have taken me about a month to finish. (Unless I get that damn script working for GGNFS, which I might be able to do if I could find the *correct* directory for msieve.)

science_man_88 2010-08-16 21:21

[QUOTE=3.14159;225736]Ah, okay. That'll be fixed.



This, I'm going to have to retract. This would have taken me about a month to finish. (Unless I get that damn script working for GGNFS, which I might be able to do if I could find the *correct* directory for msieve.)[/QUOTE]

do you have a search function on your OS if so maybe search "mseive + GGNFS"


All times are UTC. The time now is 23:20.

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