NEWALG01.ub 10 '"Factorization by the CURRIN Method - NEWALG01 1994" 20 print "ENTER an ODD Integer : ",input SF 30 if SF/2=int(SF/2) goto 20 40 FM=(SF-1)/2 50 if FM/2-int(FM/2)>0 then FR=1 else FR=0 60 H=(FM-FR)/2 70 J=int(sqrt(H)) 80 Dx=(J*(J+FR)+J)-H 90 Cx=2*(J+FR)+1-FR 100 N=0 110 D=N*(N+Cx)+Dx 120 if D<0 then inc N goto 110 130 if (D/2)-int(D/2)>0 then DR=1 else DR=0 140 if FR=1 then if DR=1 then inc N goto 110 150 C=sqrt(D) 160 if FR=0 then if C-int(C)>0 then inc N goto 110 170 if D<>int(C)*(int(C)+FR) then inc N goto 110 180 A=2*(J+N+int(C)+FR)+1 190 B=2*(J+N-int(C))+1 200 print:print A:print B:print 210 if N<(H-J) then inc N goto 110 else goto 20 NEWALG02.ub 10 '"Factorization by the CURRIN Method - NEWALG02 1994" 20 print "ENTER an ODD Integer : ",input SF 30 if SF/2=int(SF/2) goto 20 40 FM=(SF-1)/2 50 if FM/2-int(FM/2)>0 then FR=1 else FR=0 60 H=(FM-FR)/2 70 J=int(sqrt(H)) 80 Dx=(J*(J+FR)+J)-H 90 Cx=2*(J+FR)+1-FR 100 N=0 110 D=N*(N+Cx)+Dx 120 if D<0 then inc N goto 110 130 if (D/2)-int(D/2)>0 then DR=1 else DR=0 140 if FR=1 then if DR=1 then inc N goto 110 150 C=sqrt(D) 160 if FR=0 then if C-int(C)>0 then inc N goto 110 170 if D<>int(C)*(int(C)+FR) then inc N goto 110 180 A=Cx+((((int(C))-N)+N)+N)*2+FR 190 B=Cx-((int(C)-N)*2)-FR 200 print:print A:print B:print 210 if N<(H-J) then inc N goto 110 else goto 20 PFACTORS.ub 10 '"CURRIN Prime Factorization Algorithm PFACTORS 1994" 20 print "ENTER an Integer : "; input SF 30 if SF<1 then goto 20 40 A=1 50 Lim=16 60 if SF/2>int(SF/2) goto 100 70 print 2 80 SF=SF/2 90 goto 60 100 H=(SF-1)/4 110 print "....." 120 SFx=SF 130 if H=int(H) then FR=0 140 if H=int(H) then goto 170 150 FR=1 160 H=int((((SF-1)/2)-1)/2) 170 J=int(sqrt(H)) 180 Lim=Lim*2 190 P=int(H/Lim) 200 P0=P*(P+FR)+P 210 if H>P0 then goto 720 220 PDx=P0-H 230 FFB=P-int(sqrt(PDx)) 240 if FFB<=((A-1)/2) then goto 720 250 Dx=(J*(J+FR)+J)-H 260 if Dx<0 then J=J+1 270 if Dx<0 then goto 250 280 X=J-(int(sqrt(Dx))) 290 if max(2048,2*FFB+1)<>2048 then goto 440 300 Alim=max(2048,2*FFB+1) 310 print "-----" 320 A=A+2 330 if A>=(2*X+1) goto 670 340 if A>Alim then goto 440 350 if J<=((A-1)/2) goto 670 360 if A>Alim then goto 440 370 Z=SF/A 380 if Z>int(Z) then goto 320 390 if SF=A goto 670 400 print A 410 if SF=A goto 670 420 SF=SF/A 430 goto 370 440 SFy=SF 450 if SFy<>SFx then goto 100 460 print "+++++" 470 if P0 then goto 710 700 Ppp=2*P 710 P=Ppp 720 print "*****" 730 J=J+N 740 N=0 750 Dx=(J*(J+FR)+J)-H 760 if Dx>0 goto 800 770 if Dx=0 then goto 900 780 J=J+1 790 goto 750 800 Cx=(2*(J+FR)+1-FR) 810 D=N*(N+Cx)+Dx 820 C=int(sqrt(D)) 830 if D/C=C+FR then goto 900 840 X=J+N-C 850 if X<=((A-1)/2) then goto 670 860 N=N+1 870 if N>(Lim/2) then goto 180 880 if J+N>P then goto 300 890 goto 810 900 FA=2*(J+N+C+FR)+1 910 FB=2*(J+N-C)+1 920 goto 640 930 print "Press F5 to run the program again...":end RAND4272.ub 10 '"CURRIN Factorization Method - RAND4272 algorithm 1994" 20 '"This example randomizes factors and composites" 30 print "INPUT power of 2 : >800 and <4273 : "; input Y 40 A=2^Y-1 50 RX=irnd*2^int(Y*0.49) 60 SA=A+RX 70 RX=irnd*2^int(Y*0.49) 80 SB=SA+RX 90 SF=SA*SB:if SF/2=int(SF/2) then goto 50 100 FM=(SF-1)/2 110 if FM/2-int(FM/2)>0 then FR=1 else FR=0 120 H=(FM-FR)/2 130 J=int(sqrt(H)) 140 Dx=(J*(J+FR)+J)-H 150 Cx=2*(J+FR)+1-FR 160 N=0 170 D=N*(N+Cx)+Dx 180 if D<0 then inc N goto 170 190 if (D/2)-int(D/2)>0 then DR=1 else DR=0 200 if FR=1 then if DR=1 then inc N goto 170 210 C=sqrt(D) 220 if FR=0 then if C-int(C)>0 then inc N goto 170 230 if D<>int(C)*(int(C)+FR) then inc N goto 170 240 A=2*(J+N+int(C)+FR)+1 250 B=2*(J+N-int(C))+1 260 cls:print "SF (composite) = ";SF:print 270 print "A = ";A:print "B = ";B 280 goto 50 RSA129XX.ub 10 '"Factorization by the CURRIN Method - RSA129XX 1994" 20 SF=1143816257578888676692357799761466120102182967212423625625618429357 06935245733897830597123563958705058989075147599290026879543541 30 FM=(SF-1)/2 40 if FM/2-int(FM/2)>0 then FR=1 else FR=0 50 H=(FM-FR)/2 60 J=int(sqrt(H)) 70 Dx=(J*(J+FR)+J)-H 80 Cx=2*(J+FR)+1-FR 90 N=3717448333985354362120355606030139738487355104819018340138908985 100 D=N*(N+Cx)+Dx 110 if D<0 then inc N goto 100 120 if (D/2)-int(D/2)>0 then DR=1 else DR=0 130 if FR=1 then if DR=1 then inc N goto 100 140 C=sqrt(D) 150 if FR=0 then if C-int(C)>0 then inc N goto 100 160 if D<>int(C)*(int(C)+FR) then inc N goto 100 170 A=2*(J+N+int(C)+FR)+1 180 B=2*(J+N-int(C))+1 190 print:print A:print B:print 200 print "RSA 129 = ":print SF:print:end