English
Source / code snippets

natural numbers in your Primfaktoren decompose

 

p.specht

Each arbitrary natural number can itself in Primzahl-factors decompose. These fact is Mathematikern under the of Gauss geprägten concept "Fundamentalsatz the Arithmetik" famous. apiece larger The number, circa so quadratic-überproportional zeitaufwändig becomes these Zerlegung but, because yet watts no too for gigantic Ganzzahlen funktionierender rascher Faktorisierungsalgorithmus famous. very therefore can so wirksam Messages code, because only derjenige, the The Primfaktoren famous given go (z.B. of/ one two large factors plus one more public Key), the can The message in vernünftiger Time again decode. with not too large numbers is a Zerlegung however in kurzer Time possible, How the nachstehende in XProfan-11 übersetzte Progrämmchen proving.

Nachsatz: self Today Supercomputer or even Quantencomputer create a Zerlegung really great numbers not military interessanter Time (If the battle past is, has namely nobody More what of it). though should we The Findigkeit the Crypto-Experten not unterschätzen: someone has z.B. to some Time a derartigen code geknackt, in the it it as DNA-before synthetisierte. subsequently watts this billionenfach geklont (today no trouble More, lasts ca. 19 hours) and finally through employment verschiedener Enzyme, The large Primzahlen code 8O and itself on whom before anlagern, The fehlende number herausgefiltert - accordingly the code geknackt!

Window Title upper$("Faktorisierung of natural Zahlen")
' *******************************************
'* Sample run:                               *
'* ? 394616                                  *
'*     2 2 2 107 461                         *
'* ----------------------------------------- *
'* Ref.: "Mathématiques par l'informatique   *
'*        individuelle (1) par H. Lehning    *
'*        et D. Jakubowicz, Masson, Paris,   *
'*        1982"                                   *
'* ----------------------------------------- *
'*               C++ Version by J-P Moreau.  *
'*                    (www.jpmoreau.fr)      *
'*   XProfan Version by P.woodpecker, Wien (AT)  *
'*     without Gewähr! No warranty whatsoever!  *
'* ----------------------------------------- ********
'* Gegenprüfungsmöglichkeit:                         *
'* https://de.numberworld.info/faktorisierungsRechner *
' ***************************************************
set("decimals",0):windowStyle 24:font 2
Declare d!,eps!,m!,n!,i!:eps!=0.000001
start:
Cls:print
rept:
'print " Integer number to be factorized ?: ";:input n!
print " Integerzahl, The in Primfaktoren zerlegt go should ?: ";:input n!
case n!<0:End
case n!=0:n!=4294967295

if n!>4294967295:print " *** Overflow Error ***\n" : goto "rept":endif

    print "   ";
    e50:
    d!=n!-2*intf(n!/2)

    if (abs(d!)<eps!): print "2 ";: n!=n!/2: goto "e50":endif

        e100:
        d!=n!-3*intf(n!/3)

        if abs(d!)<eps!:print "3 ";: n!=n!/3: goto "e100":endif

            ' // All Prime numbers >3 are of the shape 6i-1 or 6i+1
            m!=floor(sqrt(n!))+1
            i!=6

            while i!<(m!+1)

                e150:
                d!=n!-(i!-1)*intf(n!/(i!-1))

                if (abs(d!)<eps!) :print i!-1,: n!=n!/(i!-1): goto "e150":endif

                    e200:
                    d!=n!-(i!+1)*intf(n!/(i!+1))

                    if (abs(d!)<eps!):print i!+1,: n!=n!/(i!+1): goto "e200":endif

                        i!=i!+6

                    endwhile

                    case (n!>1):print n!,
                    print

                    if %csrlin>32:waitinput :goto "start":endif

                        goto "rept"
                        END
                        '===================== Math2.inc ==========================================

                        proc Sgn :parameters x!:return (x!>0)-(x!<0):endproc

                            proc floor :parameters x!:case abs(x!)<(10^-35):return 0:case x!>0

                                return intf(x!):return (abs(x!-intf(x!)) < 10^-35)-intf(abs(x!-1)):endproc

                                proc ceil :parameters x!:return -1*floor(-1*x!):endproc

                                    proc modf :parameters x!,y!:case abs(x!)<10^-35:return 0

                                        case abs(y!)<10^-35:return x!:return sgn(y!)*abs(x!-y!*floor(x!/y!)):endproc

                                        proc remn :parameters x!,y!:case abs(x!)<(10^-35):return 0

                                            case abs(y!)<(10^-35):return x!:return sgn(x!)*abs(x!-y!*floor(x!/y!)):endproc

                                            proc IsNeg :parameters x!:return byte(Addr(x!),7)&%10000000>>7:endproc

                                                proc frac :parameters x!:var s!=sgn(x!):x!=abs(x!):x!=x!-round(x!,0)

                                                    case x!<0:x!=1+x!:return s!*x!:endproc

                                                    proc intf :parameters x!:var s!=sgn(x!):x!=abs(x!):x!=x!-frac(x!):return s!*x!

                                                    endproc

                                                    '============================================================================
 
XProfan 11
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
05/16/21  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.486 Views

Themeninformationen

this Topic has 1 subscriber:

p.specht (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie