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)

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.


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

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